You are here

function availability_calendar_process_availability_calendar_ical_vcalendar in Availability Calendars 7.5

Implements hook_process_HOOK for theme availability_calendar_ical_vcalendar.

On entry, $variables contains:

  • entity_type
  • entity
  • settings (field settings)
  • langcode?
  • cid
  • name
  • events

This process hook adds other variables the theme template expects:

  • prodId
  • title
  • language
  • method

Security note: If we are outputting an iCal feed we do not have to escape because we are not in an html context, but if we are outputting html, i.e. we are in a live preview, we also do not have to filter the output, as the views_plugin_display_feed plugin already does so for us.

Parameters

array $variables:

File

./availability_calendar.ical.inc, line 98

Code

function availability_calendar_process_availability_calendar_ical_vcalendar(&$variables) {
  require_once 'theme/availability_calendar_ical_util.php';

  // Ensure good defaults for missing variables.
  if (empty($variables['prodId'])) {
    $variables['prodId'] = variable_get('site_name', 'Drupal');
    $slogan = variable_get('site_slogan', '');
    if (!empty($slogan)) {
      $variables['prodId'] .= ' - ' . $slogan;
    }
  }
  if (empty($variables['title'])) {
    if (!empty($variables['entity_type']) && !empty($variables['entity'])) {
      $variables['title'] = entity_label($variables['entity_type'], $variables['entity']);
    }
  }
  if (empty($variables['langcode']) || $variables['langcode'] === LANGUAGE_NONE) {
    global $language;
    $variables['langcode'] = $language->language;
  }
  if (empty($variables['method'])) {
    $variables['method'] = 'PUBLISH';
  }
  $variables['dtstamp'] = getICalDateTime();
}