| 1 |
<?php
|
| 2 |
// $Id: views_handler_filter_equality.inc,v 1.1 2008/09/03 19:21:28 merlinofchaos Exp $
|
| 3 |
/**
|
| 4 |
* Simple filter to handle equal to / not equal to filters
|
| 5 |
*/
|
| 6 |
class views_handler_filter_equality extends views_handler_filter {
|
| 7 |
// exposed filter options
|
| 8 |
var $no_single = TRUE;
|
| 9 |
|
| 10 |
/**
|
| 11 |
* Provide simple equality operator
|
| 12 |
*/
|
| 13 |
function operator_options() {
|
| 14 |
return array(
|
| 15 |
'=' => t('Is equal to'),
|
| 16 |
'!=' => t('Is not equal to'),
|
| 17 |
);
|
| 18 |
}
|
| 19 |
|
| 20 |
/**
|
| 21 |
* Provide a simple textfield for equality
|
| 22 |
*/
|
| 23 |
function value_form(&$form, &$form_state) {
|
| 24 |
$form['value'] = array(
|
| 25 |
'#type' => 'textfield',
|
| 26 |
'#title' => t('Value'),
|
| 27 |
'#size' => 30,
|
| 28 |
'#default_value' => $this->value,
|
| 29 |
);
|
| 30 |
|
| 31 |
if (!empty($form_state['exposed'])) {
|
| 32 |
$identifier = $this->options['expose']['identifier'];
|
| 33 |
if (!isset($form_state['input'][$identifier])) {
|
| 34 |
$form_state['input'][$identifier] = $this->value;
|
| 35 |
}
|
| 36 |
}
|
| 37 |
}
|
| 38 |
}
|
| 39 |
|