You are here

function theme_calendar_views_field in Calendar 5.2

Wrapper around views_theme_field() to properly format the dates in the view. Use the usual views field formatting for all other fields.

Override the calendar's custom formating for calendar fields. This one we trim the node title to 12 chars so that it's formatted nicer.

5 theme calls to theme_calendar_views_field()
theme_calendar_node_day in ./calendar.theme
Format an calendar node for display in an expanded calendar, like a calendar page
theme_calendar_node_month in ./calendar.theme
Format an calendar node for display in an expanded calendar, like a calendar page
theme_calendar_node_week in ./calendar.theme
Format an calendar node for display in an expanded calendar, like a calendar page
theme_calendar_view_list in ./calendar.theme
Display the nodes of a view as a list.
theme_calendar_view_table in ./calendar.theme
Display the nodes of a view as a table.

File

./calendar.theme, line 748

Code

function theme_calendar_views_field($fieldname, $fields, $field, $node, $view, $type) {
  $length = variable_get('calendar_truncate_length_' . $view->name, '');
  if (isset($node->calendar_field_theme)) {
    $theme = $node->calendar_field_theme;
    return theme($theme, $fieldname, $fields, $field, $node, $view, $type);
  }
  $calendar_fields = calendar_fields();
  if (!in_array($field['field'], array_keys($calendar_fields))) {
    $item = views_theme_field('views_handle_field', $fieldname, $fields, $field, $node, $view);
    if ($view->calendar_type != 'day' && !empty($length)) {
      $item = str_replace(">" . check_plain($node->title), ' title="' . check_plain($node->title) . '">' . check_plain(calendar_trim_text($node->title, $length)), $item);
    }
  }
  elseif ($fieldname != $node->datefield) {
    $item = '';
  }
  else {
    if (!empty($node->{$fieldname})) {
      $item = theme('calendar_date_combo', $field, $node, $field['label'], $view);
    }
  }
  return $item;
}