1 views_handler_filter_numeric.inc views_handler_filter_numeric::operators()

File

core/modules/views/handlers/views_handler_filter_numeric.inc, line 29
Definition of views_handler_filter_numeric.

Class

views_handler_filter_numeric
Simple filter to handle greater than/less than filters

Code

function operators() {
  $operators = array(
    '<' => array(
      'title' => t('Is less than'),
      'method' => 'op_simple',
      'short' => t('<'),
      'values' => 1,
    ),
    '<=' => array(
      'title' => t('Is less than or equal to'),
      'method' => 'op_simple',
      'short' => t('<='),
      'values' => 1,
    ),
    '=' => array(
      'title' => t('Is equal to'),
      'method' => 'op_simple',
      'short' => t('='),
      'values' => 1,
    ),
    '!=' => array(
      'title' => t('Is not equal to'),
      'method' => 'op_simple',
      'short' => t('!='),
      'values' => 1,
    ),
    '>=' => array(
      'title' => t('Is greater than or equal to'),
      'method' => 'op_simple',
      'short' => t('>='),
      'values' => 1,
    ),
    '>' => array(
      'title' => t('Is greater than'),
      'method' => 'op_simple',
      'short' => t('>'),
      'values' => 1,
    ),
    'between' => array(
      'title' => t('Is between'),
      'method' => 'op_between',
      'short' => t('between'),
      'values' => 2,
    ),
    'not between' => array(
      'title' => t('Is not between'),
      'method' => 'op_between',
      'short' => t('not between'),
      'values' => 2,
    ),
  );

  // 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,
      ),
    );
  }

  // Add regexp support for MySQL.
  if (Database::getConnection()->databaseType() == 'mysql') {
    $operators += array(
      'regular_expression' => array(
        'title' => t('Regular expression'),
        'short' => t('regex'),
        'method' => 'op_regex',
        'values' => 1,
      ),
    );
  }

  return $operators;
}