You are here

function template_preprocess_calendar_item in Calendar 7.3

Same name and namespace in other branches
  1. 8 calendar.theme.inc \template_preprocess_calendar_item()

Implementation of hook_preprocess_calendar_item().

File

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

Code

function template_preprocess_calendar_item(&$vars) {

  // At the last possible minute we fix the values in rendered_fields so it
  // contains the correct rendered content for the type of item and item display.
  $item = $vars['item'];
  $multiday_hidden = !empty($vars['view']->style_options['multiday_hidden']) ? $vars['view']->style_options['multiday_hidden'] : array();
  if (!empty($item->rendered) && empty($item->is_multi_day)) {
    $vars['rendered_fields'] = array(
      $item->rendered,
    );
  }
  else {
    foreach ($vars['view']->field as $id => $field) {
      if ($field->options['exclude'] || !empty($item->is_multi_day) && in_array($id, $multiday_hidden)) {
        unset($vars['rendered_fields'][$id]);
      }
    }
  }
}