You are here

function date_ical_preprocess_node in Date iCal 7.2

Same name and namespace in other branches
  1. 7.3 date_ical.module \date_ical_preprocess_node()
  2. 7 date_ical.module \date_ical_preprocess_node()

Implements hook_preprocess_HOOK() for nodes.

Hide extraneous information when rendering the iCal view mode of a node.

File

./date_ical.module, line 69
Adds ical functionality to Views, and an iCal parser to Feeds.

Code

function date_ical_preprocess_node(&$variables) {
  if (isset($variables['view_mode']) && $variables['view_mode'] == 'ical') {

    // We hide the page elements we won't want to see.
    // The display of the body and other fields will be controlled
    // by the Manage Display settings for the iCal view mode.
    // Trick the default node template into not displaying the page title by
    // telling it this is a page.
    $variables['page'] = TRUE;
    $variables['title_prefix'] = '';
    $variables['title_suffix'] = '';

    // We don't want to see the author information in our feed.
    $variables['display_submitted'] = FALSE;

    // Comments and links don't belong in an iCal feed.
    if (isset($variables['content']['comments'])) {
      unset($variables['content']['comments']);
    }
    if (isset($variables['content']['links'])) {
      unset($variables['content']['links']);
    }
  }
}