Recipe 81: Grouped View
Note
Ingredients
Completed Recipe 79, or thorough read-through
Completed Recipe 80, to at least Step 3
Computed field module: http://drupal.org/project/computed_field
Regenerate module: http://drupal.org/node/195013#comment-854212
Devel module: http://drupal.org/project/devel
The Theme wizard, which we used in Recipe 79 for a Simple List view, also offers a Grouped List view. We'll group items in a view by month.
The most convenient method for grouping with the Theme wizard is to simply store a new variable in the database, containing the group name. We'll use the Computed Field module to achieve this.
Complete Recipe 80, up to at least Step 3.
Install and enable the Computed Field module.
Click on Add field at
admin/content/types/event/fields
. Name the field Month, and select the Computed field. Click on the Create field button.Enter the following into the Computed Code area:
$node_field[0]['value'] = format_date($node->field_event_date[0]['value'], 'custom', "F");
You will...