You are here

public function BooleanOperatorString::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 BooleanOperator::query

File

lib/Drupal/views/Plugin/views/filter/BooleanOperatorString.php, line 29
Definition of Drupal\views\Plugin\views\filter\BooleanOperatorString.

Class

BooleanOperatorString
Simple filter to handle matching of boolean values.

Namespace

Drupal\views\Plugin\views\filter

Code

public function query() {
  $this
    ->ensureMyTable();
  $where = "{$this->tableAlias}.{$this->realField} ";
  if (empty($this->value)) {
    $where .= "= ''";
    if ($this->accept_null) {
      $where = '(' . $where . " OR {$this->tableAlias}.{$this->realField} IS NULL)";
    }
  }
  else {
    $where .= "<> ''";
  }
  $this->query
    ->add_where($this->options['group'], $where);
}