You are here

function views_json_query_handler_filter::operators in Views JSON Query 7

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

File

handlers/views_json_query_handler_filter.inc, line 29
Base filter handler for views_json_query.

Class

views_json_query_handler_filter
@file Base filter handler for views_json_query.

Code

function operators() {
  $operators = array(
    '=' => array(
      'title' => t('Is equal to'),
      'short' => t('='),
      'method' => 'op_equal',
      'values' => 1,
    ),
    '!=' => array(
      'title' => t('Is not equal to'),
      'short' => t('!='),
      'method' => 'op_equal',
      'values' => 1,
    ),
    'contains' => array(
      'title' => t('Contains'),
      'short' => t('contains'),
      'method' => 'op_contains',
      'values' => 1,
    ),
    '!contains' => array(
      'title' => t('Does not contain'),
      'short' => t('!has'),
      'method' => 'op_not',
      'values' => 1,
    ),
    'shorterthan' => array(
      'title' => t('Length is shorter than'),
      'short' => t('shorter than'),
      'method' => 'op_shorter',
      'values' => 1,
    ),
    'longerthan' => array(
      'title' => t('Length is longer than'),
      'short' => t('longer than'),
      'method' => 'op_longer',
      'values' => 1,
    ),
  );

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