You are here

public function BooleanOperator::query in Views (for Drupal 7) 8.3

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

2 methods override BooleanOperator::query()
BooleanOperatorString::query in lib/Drupal/views/Plugin/views/filter/BooleanOperatorString.php
Add this filter to the query.
Current::query in lib/Views/user/Plugin/views/filter/Current.php
Add this filter to the query.

File

lib/Drupal/views/Plugin/views/filter/BooleanOperator.php, line 169
Definition of Drupal\views\Plugin\views\filter\BooleanOperator.

Class

BooleanOperator
Simple filter to handle matching of boolean values

Namespace

Drupal\views\Plugin\views\filter

Code

public function query() {
  $this
    ->ensureMyTable();
  $field = "{$this->tableAlias}.{$this->realField}";
  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, '<>');
    }
  }
}