You are here

function template_preprocess_calendar_node in Calendar 7

Same name in this branch
  1. 7 theme/theme.inc \template_preprocess_calendar_node()
  2. 7 calendar_multiday/theme/theme.inc \template_preprocess_calendar_node()
Same name and namespace in other branches
  1. 6.2 theme/theme.inc \template_preprocess_calendar_node()
  2. 6.2 calendar_multiday/theme/theme.inc \template_preprocess_calendar_node()
  3. 7.2 theme/theme.inc \template_preprocess_calendar_node()
  4. 7.2 calendar_multiday/theme/theme.inc \template_preprocess_calendar_node()

Format an calendar node for display.

6 calls to template_preprocess_calendar_node()
template_preprocess_calendar_day_node in theme/theme.inc
Format an calendar day node for display.
template_preprocess_calendar_day_node in calendar_multiday/theme/theme.inc
Format an calendar day node for display.
template_preprocess_calendar_month_node in theme/theme.inc
Format an calendar month node for display.
template_preprocess_calendar_month_node in calendar_multiday/theme/theme.inc
Format an calendar month node for display.
template_preprocess_calendar_week_node in theme/theme.inc
Format an calendar week node for display.

... See full list

File

calendar_multiday/theme/theme.inc, line 723
Theme functions for the Calendar module.

Code

function template_preprocess_calendar_node(&$vars) {
  $node = $vars['node'];
  $view = $vars['view'];
  $fields = array();
  foreach ($view->field as $name => $field) {

    // Some fields, like the node edit and delete links, have no alias.
    $field_alias = $field->field_alias != 'unknown' ? $field->field_alias : $name;
    if (!empty($node->{$field_alias})) {
      $data = $node->{$field_alias};
      $label = $field->options['label'];

      // CCK has some special label options.
      if (!empty($field->content_field)) {
        switch ($field->options['label_type']) {
          case 'none':
            $label = '';
            break;
          case 'widget':
            $label = $field->content_field['widget']['label'];
            break;
        }
      }
      $fields[$field_alias] = array(
        'id' => drupal_clean_css_identifier($field_alias),
        'label' => $label,
        'data' => $data,
      );
    }
  }
  $vars['fields'] = $fields;
  $vars['calendar_start'] = $node->calendar_start;
  $vars['calendar_end'] = $node->calendar_end;
  $vars['calendar_start_date'] = $node->calendar_start_date;
  $vars['calendar_end_date'] = $node->calendar_end_date;

  // We added the node type to the results in the query,
  // but it will show up as $node->node_type instead of
  // $node->type. Rename it to match the normal way it
  // would show up on a node object.
  $vars['node']->type = $vars['node']->node_type;
}