function BooleanOperator::opEmpty

Filters by operator empty.

Parameters

string $field: The views field.

File

core/modules/views/src/Plugin/views/filter/BooleanOperator.php, line 360

Class

BooleanOperator
Simple filter to handle matching of boolean values.

Namespace

Drupal\views\Plugin\views\filter

Code

protected function opEmpty(string $field) : void {
  if ($this->operator === 'empty') {
    $operator = "IS NULL";
  }
  else {
    $operator = "IS NOT NULL";
  }
  $this->query
    ->addWhere($this->options['group'], $field, NULL, $operator);
}

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