1 date_views_filter_handler.inc date_views_filter_handler::admin_summary()

Display the filter on the administrative summary

Overrides date_views_filter_handler_simple::admin_summary

File

core/modules/date/views/date_views_filter_handler.inc, line 125
A flexible, configurable date filter. This filter combines multiple date filters into a single filter where all fields are controlled by the same date and can be combined with either AND or OR.

Class

date_views_filter_handler
@file A flexible, configurable date filter. This filter combines multiple date filters into a single filter where all fields are controlled by the same date and can be combined with either AND or OR.

Code

function admin_summary() {
  if (empty($this->options['date_fields'])) {
    return t('Missing date fields!');
  }
  $handler = $this->date_handler;

  $fields = date_views_fields($this->view->base_table);
  $output = array();
  if (!empty($this->options['date_fields'])) {
    foreach ($this->options['date_fields'] as $field) {
      if (array_key_exists($field, $fields['name'])) {
        $output[] = $fields['name'][$field]['label'];
      }
    }
  }
  $field = implode(' ' . $this->options['date_method'] . ' ', $output);
  $output = "$field " . check_plain($this->operator) . ' ';
  $parts = $handler->date_parts();
  $widget_options = $this->widget_options();
  // If the filter is exposed, display the granularity.
  if ($this->options['exposed']) {
    return t('(@field) <strong>Exposed</strong> @widget @format', array('@field' => $field, '@format' => $parts[$handler->granularity], '@widget' => $widget_options[$this->options['form_type']]));
  }
  // If not exposed, display the value.
  if (in_array($this->operator, $this->operator_values(2))) {
    $min = check_plain(!empty($this->options['default_date']) ? $this->options['default_date'] : $this->options['value']['min']);
    $max = check_plain(!empty($this->options['default_to_date']) ? $this->options['default_to_date'] : $this->options['value']['max']);
    $output .= t('@min and @max', array('@min' => $min, '@max' => $max));
  }
  else {
    $output .= check_plain(!empty($this->options['default_date']) ? $this->options['default_date'] : $this->options['value']['value']);
  }
  return $output;
}