You are here

function date_views_filter_handler::get_query_fields in Date 7

Same name and namespace in other branches
  1. 8 date_views/includes/date_views_filter_handler.inc \date_views_filter_handler::get_query_fields()
  2. 7.3 date_views/includes/date_views_filter_handler.inc \date_views_filter_handler::get_query_fields()
  3. 7.2 date_views/includes/date_views_filter_handler.inc \date_views_filter_handler::get_query_fields()
1 call to date_views_filter_handler::get_query_fields()
date_views_filter_handler::query in date_views/includes/date_views_filter_handler.inc
Custom implementation of query() so we can get the AND and OR methods in the right places.

File

date_views/includes/date_views_filter_handler.inc, line 555
A flexible, configurable date filter.

Class

date_views_filter_handler
This filter allows you to select a granularity of date parts to filter on, such as year, month, day, etc.

Code

function get_query_fields() {
  $fields = date_views_fields($this->view->base_table);
  $fields = $fields['name'];
  $this->query_fields = array();
  foreach ((array) $this->options['date_fields'] as $delta => $name) {
    if (array_key_exists($name, $fields) && ($field = $fields[$name])) {
      $date_handler = new date_sql_handler();
      $date_handler
        ->construct($field['sql_type'], date_default_timezone());
      $date_handler->granularity = $this->options['granularity'];
      $this->query_fields[] = array(
        'field' => $field,
        'date_handler' => $date_handler,
      );
    }
  }
}