Blog Archives

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

Programmatically displaying an image using an imagecache preset

The following illustrates one way to render an image using an Imagecache preset. Naturally, if your imagefield has multiple uploads you could wrap this in a foreach.

 

Tagged with: , , ,
Posted in Development

Custom Voting API Calculation

The Voting API is really nice when used in conjunction with a module like Fivestar. It takes all of the complexity out of setting up a voting/rating system. On occasion, however, you need it to do some things that aren’t

Tagged with: , , , , , ,
Posted in Development

Show Menu Description Field in Node Add/Edit Form

Many components in Drupal have an optional title or description field. This text usually displays when a user hovers over an item. We had an interesting request: a client wanted to have a box that displayed text which would change every time you roll

Tagged with: , , , ,
Posted in Development

Views Taxonomy: Get Terms with Associated Nodes

This example serves as both an example of how to alter a Views2 query, as well as how to use the get_terms_by_count() function I’ve written. Unfortunately there is not (at present) a Views2 taxonomy filter that lets you “Get only terms with

Tagged with: , , , , ,
Posted in Development