1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Definition of views_handler_filter_equality.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Simple filter to handle equal to / not equal to filters
|
10 |
|
|
*
|
11 |
|
|
* @ingroup views_filter_handlers
|
12 |
|
|
*/
|
13 |
|
|
class views_handler_filter_equality extends views_handler_filter {
|
14 |
|
|
// exposed filter options
|
15 |
|
|
var $always_multiple = TRUE;
|
16 |
|
|
|
17 |
|
|
/**
|
18 |
|
|
* Provide simple equality operator
|
19 |
|
|
*/
|
20 |
|
|
function operator_options() {
|
21 |
|
|
return array(
|
22 |
|
|
'=' => t('Is equal to'),
|
23 |
|
|
'!=' => t('Is not equal to'),
|
24 |
|
|
);
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
/**
|
28 |
|
|
* Provide a simple textfield for equality
|
29 |
|
|
*/
|
30 |
|
|
function value_form(&$form, &$form_state) {
|
31 |
|
|
$form['value'] = array(
|
32 |
|
|
'#type' => 'textfield',
|
33 |
|
|
'#title' => t('Value'),
|
34 |
|
|
'#size' => 30,
|
35 |
|
|
'#default_value' => $this->value,
|
36 |
|
|
);
|
37 |
|
|
|
38 |
|
|
if (!empty($form_state['exposed'])) {
|
39 |
|
|
$identifier = $this->options['expose']['identifier'];
|
40 |
|
|
if (!isset($form_state['input'][$identifier])) {
|
41 |
|
|
$form_state['input'][$identifier] = $this->value;
|
42 |
|
|
}
|
43 |
|
|
}
|
44 |
|
|
}
|
45 |
|
|
} |