drupal 7.x

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):

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.

Drupal - Alter Views Exposed Filter Form

With hook_form_alter, we can adjust a Views Exposed Filter Form. For example, I had an exposed filter so users could select a particular node reference to filter on. However, the exposed filter was including unpublished nodes, and I needed to get rid of them. So with a little code like this, we can get the job done:

Drupal - Automatically Set "To date" when "From date" Changes on Popup Calendar

With a date field in Drupal, you can specify the 'To date' be the same as the 'From date' on the field settings. However, selecting a 'From date' on a node form does not automatically update the 'To date' to be the same value, and this is usually annoying for our patrons. Let's use some javascript to detect changes on our 'From date' field(s), then automatically set the 'To date' to the same date as the 'From date'.

Place this code in your custom javascript file:

Drupal - Date Repeat Rule Change Theme of "Repeats every day until"

In my use case, the most common date repeat rule used by authors is the "Repeats every day until". For example, an event spanning from October 2012 through April 2013, read something like this:

Repeats every day until Tue Apr 30 2013 .

Date is an awesome module, but this isn't an awesome way to show a date range. Let's change it to something like this instead:

October 5th, 2012 - April 30th, 2013

Looks better, eh? Charming, indeed.

Drupal - Views hook_views_query_alter Group By

So my story goes like this.... I was building a view which showed a slideshow of content. Due to some views' relationships and complex content types, we were getting duplicate results. No big deal? This happens from time to time, the views module doesn't rule the world, yet. So sometimes we can just adjust the views settings to use DISTINCT, and that will solve our problem, other times not. This was a time where DISTINCT didn't seem to be helping. Usually when this happens, I fall back to my good old friend, hook_views_query_alter().


Subscribe to RSS - drupal 7.x