Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /home1/tylerfra/public_html/includes/common.inc).

Code

Drupal 8 Batch Example

I'm in the middle of migrating a Drupal 6 site to Drupal 8 and need to write a batch in Drupal 8 to pull in a bunch of nodes from Drupal 6, so I thought I would document the process to help others.

Related api docs: https://api.drupal.org/api/drupal/core%21includes%21form.inc/group/batch/8

My module's name is disc, so be sure to replace any occurences of it with your module's name.

Headless Drupal Web App with Angular JS and DrupalGap

In this tutorial (for NYC CAMP 2015) we'll explore how to use Drupal 7 and DrupalGap 2 (powered by Angular JS) to build a decoupled ("headless") web application for Drupal. In a nutshell, here is what the app will do:

  1. A user runs the app in their browser
  2. The browser asks the user for access to their current location
  3. The app passes their location to Drupal
  4. Drupal will return nearby content (if any) to the app
  5. The app will display the locations on a map and let the user click on them to see more details

Ready? Let's rock and roll, no time to fiddle...

Headless Drupal with Angular JS and Bootstrap - Hello World

This tutorial describes how to build a very simple de-coupled Drupal web application powered by Angular JS and Bootstrap. The inspiration for writing this tutorial came after completing my first Angular JS module (angular-drupal), which of course is for Drupal!

To keep things simple, and in the spirit of "Hello World", the application will let us login using credentials from the Drupal website, and then say hello to the user upon successful login.

The complete code for this example app is available here: https://github.com/signalpoint/headless-drupal-angular-bootstrap-hello-w...

Ready? Alright, let's go headless...

Angular JS - How to Unit Test a Service

I've been working on my first Angular JS module, with the hopes I can share it with the community. Before doing that, I need to finish its implementation, and now that I've been playing around with Angular for a few weeks (and having a ton of prior JavaScript development experience), I could blast through this module's implementation very quickly.

Grunt Watch and Uglify

Let's say we have a directory structure like so:

build/
node_modules/
src/*.js
Gruntfile.js
package.json
...

And all of our project's source code lives in the src directory:

src/hello.js
src/world.js

We'd like all of the code from these files to be compiled down and uglified into this file:

Angular JS Change Route Programmatically

Sometimes we'll want to dynamically change the route in Angular during some custom code execution. Here's how we can do it:

$location.path('/foo');

If your call to $location takes place in an async success callback (i.e. after making a POST request to a server), you may also have to reload the route:

$route.reload();

PhoneGap JavaScript Console Log Debugging

When compiling an app to your phone over USB using the PhoneGap (Cordova) Command Line Interface (CLI), it can be handy to view the JavaScript console.log(). Run this terminal command after your app is running in debug mode:

adb logcat

That will get you lots and lots of debug information. Chances are that's too much to handle, and you'll want to filter it. Go ahead and stop logcat, and try this command instead:

adb shell logcat | grep 'Web Console'

Drupal Commerce Address Field - How to make the company required?

It's possible to make the Organisation name (aka Company) field on an Address required during the Drupal Commerce checkout process. With a custom module, you can do this:

/**
 * Implements hook_form_alter().
 */
function my_module_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'commerce_checkout_form_checkout') {
    $form['customer_profile_billing']['commerce_customer_address']['und'][0]['organisation_block']['organisation_name']['#required'] = TRUE;
  }
}

Build a Mobile App to Geo Locate Nearby Places with Drupal

In this tutorial (for DrupalCamp Ohio 2014) we'll explore how to build a mobile application and website that can geo locate places near our current position. The nearby location results will be displayed on a map, and will allow us to click on a result item to view its complete details.

The website will be powered by Drupal 7. The mobile application will be built using DrupalGap, which is powered by PhoneGap and jQuery Mobile. Let's get started!

Drupal Address Field Component Names in Plain English

Even after many years of using the Address Field moule, I still forget what the component names mean in English from time to time. So here's a list to help me (and you) remember (some of them are super obvious, so I'll leave them blank, others I'll leave up to your interpretation and let you figure it out for fun):

Pages

Subscribe to RSS - Code