You are here

function template_preprocess_date_ical_vcalendar in Date iCal 7

Preprocess an iCal feed

File

theme/theme.inc, line 11
Theme files for Date iCal.

Code

function template_preprocess_date_ical_vcalendar(&$variables) {
  $view = $variables['view'];
  $ical_description = $view->style_plugin->options['description'];
  $view_title = $view
    ->get_title();
  $site_name = variable_get('site_name', 'Drupal');

  // If an iCal Description has been set in the Feed Style options, that is used as the
  // title in the iCal feed. If not, the View Title is used. If that is blank, then the
  // Site Name is used.
  if (!empty($ical_description)) {
    $title = $ical_description;
  }
  elseif (!empty($view_title)) {
    $title = $view_title;
  }
  else {
    $title = $site_name;
  }
  $variables['title'] = check_plain($title);

  // During live preview we don't want to output the header since the contents
  // of the feed are being displayed inside a normal HTML page.
  if (empty($variables['view']->live_preview)) {

    // Keep devel module from appending queries to ical export.
    $GLOBALS['devel_shutdown'] = FALSE;
    drupal_add_http_header('Content-Type', 'application/calendar; charset=utf-8');
  }
}