1 date_views_argument_handler.inc date_views_argument_handler::query($group_by = FALSE)

Set up the query for this argument.

The argument sent may be found at $this->argument.

Overrides date_views_argument_handler_simple::query


core/modules/date/views/date_views_argument_handler.inc, line 142
Date API views argument handler. This argument combines multiple date arguments into a single argument where all fields are controlled by the same date and can be combined with either AND or OR.




function query($group_by = FALSE) {

  // @TODO Not doing anything with $group_by yet, need to figure out what has to be done.

  if ($this->date_forbid()) {
  $this->query->set_where_group($this->options['date_method'], $this->options['date_group']);
  $this->granularity = $this->date_handler->arg_granularity($this->argument);
  $format = $this->date_handler->views_formats($this->granularity, 'sql');

  $this->placeholders = array();

  if (!empty($this->query_fields)) {
    // Use set_where_group() with the selected date_method
    // of 'AND' or 'OR' to create the where clause.
    foreach ($this->query_fields as $count => $query_field) {
      $field = $query_field['field'];
      $this->date_handler = $query_field['date_handler'];
      $this->field = $field['field_name'];
      $this->real_field = $field['field_name'];
      $this->table = $field['table_name'];
      $this->original_table = $field['table_name'];
      if ($field['table_name'] != $this->table || !empty($this->relationship)) {
        $this->table = $this->query->ensure_table($field['table_name'], $this->relationship);
      // $this->table_alias gets set when the first field is processed if otherwise empty.
      // For subsequent fields, we need to be sure it is emptied again.
      elseif (empty($this->relationship)) {
        $this->table_alias = NULL;

      $this->placeholders = array_merge($this->placeholders, $this->date_handler->placeholders);