function ManyToOne::operators in Views (for Drupal 7) 8.3
This kind of construct makes it relatively easy for a child class to add or remove functionality by overriding this function and adding/removing items from this array.
Overrides InOperator::operators
2 calls to ManyToOne::operators()
- ManyToOne::ensureMyTable in lib/
Drupal/ views/ Plugin/ views/ filter/ ManyToOne.php - Override ensureMyTable so we can control how this joins in. The operator actually has influence over joining.
- Roles::operators in lib/
Views/ user/ Plugin/ views/ filter/ Roles.php - Override empty and not empty operator labels to be clearer for user roles.
1 method overrides ManyToOne::operators()
- Roles::operators in lib/
Views/ user/ Plugin/ views/ filter/ Roles.php - Override empty and not empty operator labels to be clearer for user roles.
File
- lib/
Drupal/ views/ Plugin/ views/ filter/ ManyToOne.php, line 59 - Definition of Drupal\views\Plugin\views\filter\ManyToOne.
Class
- ManyToOne
- Complex filter to handle filtering for many to one relationships, such as terms (many terms per node) or roles (many roles per user).
Namespace
Drupal\views\Plugin\views\filterCode
function operators() {
$operators = array(
'or' => array(
'title' => t('Is one of'),
'short' => t('or'),
'short_single' => t('='),
'method' => 'op_helper',
'values' => 1,
'ensure_my_table' => 'helper',
),
'and' => array(
'title' => t('Is all of'),
'short' => t('and'),
'short_single' => t('='),
'method' => 'op_helper',
'values' => 1,
'ensure_my_table' => 'helper',
),
'not' => array(
'title' => t('Is none of'),
'short' => t('not'),
'short_single' => t('<>'),
'method' => 'op_helper',
'values' => 1,
'ensure_my_table' => 'helper',
),
);
// if the definition allows for the empty operator, add it.
if (!empty($this->definition['allow empty'])) {
$operators += array(
'empty' => array(
'title' => t('Is empty (NULL)'),
'method' => 'op_empty',
'short' => t('empty'),
'values' => 0,
),
'not empty' => array(
'title' => t('Is not empty (NOT NULL)'),
'method' => 'op_empty',
'short' => t('not empty'),
'values' => 0,
),
);
}
return $operators;
}