function views_handler_filter_string_compare::operators in Amazon Product Advertisement API 7.2
Same name and namespace in other branches
- 6 includes/views_handler_filter_string_compare.inc \views_handler_filter_string_compare::operators()
- 7 includes/views_handler_filter_string_compare.inc \views_handler_filter_string_compare::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.
3 calls to views_handler_filter_string_compare::operators()
- views_handler_filter_string_compare::operator_options in includes/
views_handler_filter_string_compare.inc - Build strings from the operators() for 'select' options
- views_handler_filter_string_compare::operator_values in includes/
views_handler_filter_string_compare.inc - views_handler_filter_string_compare::query in includes/
views_handler_filter_string_compare.inc - Add this filter to the query.
File
- includes/
views_handler_filter_string_compare.inc, line 24
Class
- views_handler_filter_string_compare
- Basic textfield filter to handle string filtering commands including equality, like, not like, etc.
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,
),
'<' => array(
'title' => t('Is less than'),
'short' => t('!='),
'method' => 'op_equal',
'values' => 1,
),
'>' => array(
'title' => t('Is greater than'),
'short' => t('!='),
'method' => 'op_equal',
'values' => 1,
),
'contains' => array(
'title' => t('Contains'),
'short' => t('contains'),
'method' => 'op_contains',
'values' => 1,
),
'word' => array(
'title' => t('Contains any word'),
'short' => t('has word'),
'method' => 'op_word',
'values' => 1,
),
'allwords' => array(
'title' => t('Contains all words'),
'short' => t('has all'),
'method' => 'op_word',
'values' => 1,
),
'starts' => array(
'title' => t('Starts with'),
'short' => t('begins'),
'method' => 'op_starts',
'values' => 1,
),
'ends' => array(
'title' => t('Ends with'),
'short' => t('ends'),
'method' => 'op_ends',
'values' => 1,
),
'not' => array(
'title' => t('Does not contain'),
'short' => t('!has'),
'method' => 'op_not',
'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 (NULL)'),
'method' => 'op_empty',
'short' => t('not empty'),
'values' => 0,
),
);
}
return $operators;
}