You are here

function date_ical_preprocess_node in Date iCal 7

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

Implements hook_preprocess_HOOK() for nodes.

Hide extraneous information when printing an ical view. The same thing can be done in the theme for other entities, and this function can be overridden in the theme to produce different results for nodes.

File

./date_ical.module, line 51
Adds ical functionality to Views.

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 Display Fields settings for the ical view mode.
    // Trick the default node template into not displaying the page title by telling it this is page.
    $variables['page'] = TRUE;
    $variables['title_prefix'] = '';
    $variables['title_suffix'] = '';

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

    // No comments in a feed.
    if (isset($variables['content']['comments'])) {
      unset($variables['content']['comments']);
    }

    // No links in a feed.
    if (isset($variables['content']['links'])) {
      unset($variables['content']['links']);
    }
  }
}