Drupal 7

Webform values for select options

There are two issues related to select options for Webform based forms.

codit_build_menu_list() - Generate a column list from a menu

If you need to make a multicolumn list from a Drupal menu (or even a vocabulary) this function allows you to do that.

codit_menu_or_array_as_select_list() - Generate a select list for a form.

It can take a menu or simply an array of items and build a select form element (not the entire form, just the select). It has the following features.

Overlay Independence

In Drupal 7 you seem to be sometimes stuck in that the media browser requires the "overlay" module to be enabled in order to work properly. This is due to the media browser relying on the jquery bbq library being added by the overlay module. You can always just add the library in your own module or tpl.

Getting the bundle of nodes or terms

Sometimes it is helpful to figure out what kind of bundle you are working with. On a node, the bundle would be the content type machine name of the node, (ex: article, info...) On a term page the bundle would be the actual vocabulary machine name of the vocabulary (ex: activities, cities, regions,)

Calling this function on the loaded entity will return the bundle name.

Trimming Text Safely in Drupal

Something more for the developer blog ;)

There are two options that work pretty well for trimming text in D7 with a higher degree of safety than trying to knock it out with php alone.

1) When you want no html in your trimmed text

= strip_tags($sSomeText);

Image Style URL

If you need to get the URL for an image file with a drupal style applied, this function is what you need to get the path for the image styles:

image_style_url($style_name, $path)


$style_name: The name of the style to be used with this image.

$path: The path to the image. Path will look like "public://mypicture.jpg"

Return value

The absolute URL where a style image can be downloaded, suitable for use in an <img> tag. Requesting the URL will cause the image to be created.

Drupal Content Type Unlock


To unlock a content type that was created by a feature, it may require direct changes to the database table

Feeds set-up for Aps

Here is some documentation for setting up feeds in Drupal 7 so that An iphone or Android ap can access the data.

The data brought together using Views and then output using the JSON from the "views_datasource" module.


Subscribe to RSS - Drupal 7