1 views_handler_filter_boolean_operator.inc views_handler_filter_boolean_operator::query()

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::query

File

core/modules/views/handlers/views_handler_filter_boolean_operator.inc, line 158
Definition of views_handler_filter_boolean_operator.

Class

views_handler_filter_boolean_operator
Simple filter to handle matching of boolean values

Code

function query() {
  $this->ensure_my_table();
  $field = "$this->table_alias.$this->real_field";

  if (empty($this->value)) {
    if ($this->accept_null) {
      $or = db_or()
        ->condition($field, 0, '=')
        ->condition($field, NULL, 'IS NULL');
      $this->query->add_where($this->options['group'], $or);
    }
    else {
      $this->query->add_where($this->options['group'], $field, 0, '=');
    }
  }
  else {
    if (!empty($this->definition['use equal'])) {
      $this->query->add_where($this->options['group'], $field, 1, '=');
    }
    else {
      $this->query->add_where($this->options['group'], $field, 0, '<>');
    }
  }
}