You are here

function date_handler_fields in Date 7

Same name and namespace in other branches
  1. 5.2 date/date.module \date_handler_fields()
  2. 6.2 date/date.module \date_handler_fields()

Identify all fields in this view that use the CCK Date handler.

2 calls to date_handler_fields()
date_handler_field_multiple::pre_render in date_views/includes/date_handler_field_multiple.inc
Run before any fields are rendered.
date_handler_field_multiple::render in date_views/includes/date_handler_field_multiple.inc
Render the field.

File

date_views/date_views.module, line 191

Code

function date_handler_fields($view) {
  $field_names = array();
  if (empty($view->date_info->date_fields)) {
    $view->date_info->date_fields = array();
  }
  foreach ($view->field as $field) {
    if ($field->definition['handler'] == 'date_handler_field_multiple') {
      $name = $field->field;
      $group = $field->options['multiple'];
      if (substr($name, -7) == '_value2') {
        $field_name = substr($name, 0, strlen($name) - 7);
      }
      elseif (substr($name, -6) == '_value') {
        $field_name = substr($name, 0, strlen($name) - 6);
      }
      else {
        $field_name = '';
        $group = array();
        continue;
      }
      foreach ($view->date_info->date_fields as $date_field) {
        if (strstr($date_field, ' . ' . $field_name)) {
          $delta_field = 'entity_data_' . $field_name . '_delta';
          $field_names[$field_name] = array(
            'options' => $group,
            'delta_field' => $delta_field,
            'view_field' => clone $field,
          );

          // Get rid of the huge view object in the field handler.
          unset($field_names[$field_name]['view_field']->view);
        }
      }
    }
  }
  return $field_names;
}