You are here

public function views_handler_filter_publication_date::query in Publication Date 7.2

Add this filter to the query.

Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.

Overrides views_handler_filter_numeric::query

File

includes/views_handler_filter_publication_date.inc, line 49
Definition of views_handler_filter_publication_date.

Class

views_handler_filter_publication_date
Filter to handle publication dates stored as a timestamp.

Code

public function query() {
  $this
    ->ensure_my_table();
  if ($this->options['null_date'] == 'null') {
    $field = "{$this->table_alias}.{$this->real_field}";
  }
  else {
    switch ($this->options['null_date']) {
      case 'now':
        $alt_value = REQUEST_TIME;
        break;
      case 'created':
        $alt_value = "node.created";
        break;
      case 'changed':
        $alt_value = "node.changed";
        break;
    }
    $field = "COALESCE({$this->table_alias}.{$this->real_field}, {$alt_value})";
  }
  $info = $this
    ->operators();
  if (!empty($info[$this->operator]['method'])) {
    $this
      ->{$info[$this->operator]['method']}($field);
  }
}