Code

Drupal - Address Field Phone, How to Make it Required

I've been using the Address Field Phone module with the Commerce and Address Field modules to collect a phone number from users during the checkout process.

Drupal - Build a Mobile App Game to Learn Words from Another Language

In this tutorial we'll explore how to make a simple mobile application game with DrupalGap for a Drupal 7 website. Our game will help us learn words in another langauge.

We'll use Drupal to manage our words and their translations. Since Drupal comes with a default content type called Article, we'll use that for our words.

PhoneGap Android ./create: line 66: javac: command not found

When trying to run this terminal command for PhoneGap in Ubuntu:

cd ~/Desktop/phonegap-2.7.0/lib/android/bin
./create ~/Desktop/phonegap-code/MyProject com.mycompany.myproject MyProject

I received this error:

./create: line 66: javac: command not found

To fix this, I had to install this (from Synaptic Package Manager):

openjdk-6-jdk

I had to remove the bogus directory that was created on the first creation failure:

rm -rf ~/Desktop/phonegap-code/MyProject

Now, re-run the create command:

Drupal - Send a Notification E-mail when a Comment is Posted

To receive an e-mail notification when a new comment is posted, try this (you won't even need to write one line of code):

An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1

With PhoneGap, everytime I try to create a new Android project from the terminal, I get this annoying error:

An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1

Luckily, this workaround always seems to work for me:

source ~/.bash_profile

After sourcing my bash profile, then re-running the create command, it completes successfully.

Drupal - Create a Menu Tab with Views for a Node Content Type

This article describes how to place a custom local task menu tab alongside the 'View' and 'Edit' tabs on a content type.

Drupal - Create a Custom Hook for Other Modules to Use

In this example, we'll explore how to make a custom hook with our module so that other modules may use it.

Drupal - Views RSS Feed Title Customization with Preprocess

Creating an RSS feed with Views in Drupal is easy as pie. You can add contextual arguments to your View to provide many different types of feeds. You can even set up custom titles based on the contextual filter arguments all without writing a line of code! Amazing.

Drupal - Webform Theme submission_url Token

After spending some time trying to figure out how to theme and/or preprocess the %submission_url provided by Webform during an e-mail notification, it appears it is not possible until the 4.x version of the module is out where Webform 'tokens' will become actual Drupal tokens (http://drupal.org/node/1001798).

Drupal - Theme "Previous", "Next", "Pause" and "Resume" Controls on a Views Slideshow

Here is how to use preprocess functions to theme the "Previous", "Next", "Pause" and "Resume" button controls text on a Views Slideshow. In this example, I wanted to change each of the buttons to text that mimics somethind you'd find on a media player.

Pages

Subscribe to RSS - Code