1 views_handler_filter_many_to_one.inc views_handler_filter_many_to_one::operators()

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 views_handler_filter_in_operator::operators

File

core/modules/views/handlers/views_handler_filter_many_to_one.inc, line 48
Definition of views_handler_filter_many_to_one.

Class

views_handler_filter_many_to_one
Complex filter to handle filtering for many to one relationships, such as terms (many terms per node) or roles (many roles per user).

Code

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;
}