function BooleanOperator::operators
Same name and namespace in other branches
- 9 core/modules/views/src/Plugin/views/filter/BooleanOperator.php \Drupal\views\Plugin\views\filter\BooleanOperator::operators()
- 8.9.x core/modules/views/src/Plugin/views/filter/BooleanOperator.php \Drupal\views\Plugin\views\filter\BooleanOperator::operators()
- 10 core/modules/views/src/Plugin/views/filter/BooleanOperator.php \Drupal\views\Plugin\views\filter\BooleanOperator::operators()
Returns an array of operator information, keyed by operator ID.
Return value
array[] An array of operator information, keyed by operator ID.
Overrides FilterOperatorsInterface::operators
3 calls to BooleanOperator::operators()
- BooleanOperator::operatorOptions in core/
modules/ views/ src/ Plugin/ views/ filter/ BooleanOperator.php - Provide a list of options for the default operator form.
- BooleanOperator::operatorValues in core/
modules/ views/ src/ Plugin/ views/ filter/ BooleanOperator.php - Returns operators for values.
- BooleanOperator::query in core/
modules/ views/ src/ Plugin/ views/ filter/ BooleanOperator.php - Add this filter to the query.
File
-
core/
modules/ views/ src/ Plugin/ views/ filter/ BooleanOperator.php, line 84
Class
- BooleanOperator
- Simple filter to handle matching of boolean values.
Namespace
Drupal\views\Plugin\views\filterCode
public function operators() {
$operators = [
'=' => [
'title' => $this->t('Is equal to'),
'method' => 'queryOpBoolean',
'short' => $this->t('='),
'values' => 1,
'query_operator' => self::EQUAL,
],
'!=' => [
'title' => $this->t('Is not equal to'),
'method' => 'queryOpBoolean',
'short' => $this->t('!='),
'values' => 1,
'query_operator' => self::NOT_EQUAL,
],
];
// If the definition allows for the empty operator, add it.
if (!empty($this->definition['allow empty'])) {
$operators += [
'empty' => [
'title' => $this->t('Is empty (NULL)'),
'method' => 'opEmpty',
'short' => $this->t('empty'),
'values' => 0,
],
'not empty' => [
'title' => $this->t('Is not empty (NOT NULL)'),
'method' => 'opEmpty',
'short' => $this->t('not empty'),
'values' => 0,
],
];
}
return $operators;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.