function BooleanOperatorString::query

Same name in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/filter/BooleanOperatorString.php \Drupal\views\Plugin\views\filter\BooleanOperatorString::query()
  2. 10 core/modules/views/src/Plugin/views/filter/BooleanOperatorString.php \Drupal\views\Plugin\views\filter\BooleanOperatorString::query()
  3. 11.x core/modules/views/src/Plugin/views/filter/BooleanOperatorString.php \Drupal\views\Plugin\views\filter\BooleanOperatorString::query()

Overrides BooleanOperator::query

File

core/modules/views/src/Plugin/views/filter/BooleanOperatorString.php, line 20

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
        ->addWhereExpression($this->options['group'], $where);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.