Yearly Archives: 2011

Get a List of Top-level Taxonomy Terms

Quick Tip: Getting a list of taxonomy terms is easy using a view (type: Taxonomy). Trying to get only terms at the highest level is a bit trickier. One method I came up with is to add a Taxonomy: Parent term argument

Tagged with: , , ,
Posted in Development

Showing a nodeasblock block as full content instead of teaser

By default, the Node As Block module displays a node in teaser mode. If you wish to show the full content, add the following to your template.php file. (note I’ve also added an edit link for good measure)

Tagged with: , , ,
Posted in Development

Sending webform submissions to email based on value of field

We recently did a site for a client that allowed patients to submit a webform to request an appointment. The user could choose their physician and based on their choice, the submission would be emailed to the chosen doctor’s secretary.

Tagged with: , , ,
Posted in Development

Using hook_form_alter() and #after_build to set maxlength on emvideo title field

A fellow Drupal user posted an issue to the Embedded Media Field project. The user was trying to set the maxlength from 35 characters to some other number for the ‘title’ field within each embedded video widget. I faced the same issue

Tagged with: , , , ,
Posted in Development

Moving a field into a (different) group/fieldset using hook_form_alter()

The following demonstrates how to move a field into a different fieldset within a form using hook_form_alter() and a special #after_build form property.

 

Tagged with: , , ,
Posted in Development

Show a timestamp as a date in the Drupal user’s timezone

 

Tagged with: , ,
Posted in Development

db_query() and db_placeholders() example #1

Have you ever wondered how to properly build a query like this in Drupal:

This requires the use of db_placeholders() to create the placeholder ‘ ‘, ‘ ‘, etc.

where $node_types is an array of node types.

Tagged with: , , , , ,
Posted in Development

Automatically create a Drupal node when a user registers

Sometimes projects come up that have requirements that cannot be solved with an out-of-the-box Drupal install. A project I worked on some time ago required that I store a node every time a user registered for an account. The details

Tagged with: , ,
Posted in Development

Make menu header a link to its first child link

We use menu block a lot to create sidebar menus with specific depths, starting points, etc. The following snippet shows how we can use jQuery to turn a normal <h2> tag into a link. The link’s destination will be the

Tagged with: ,
Posted in Development

How to check if a jQuery plugin is loaded

The following snippet is one way to determine if a jQuery plugin is loaded an available. There are probably other ways to achieve the same behavior, however this one never seems to fail me.

 

Tagged with: ,
Posted in Development