Project

General

Profile

Paste
Download (1013 Bytes) Statistics
| Branch: | Revision:

root / drupal7 / sites / all / modules / views / handlers / views_handler_filter_equality.inc @ 4003efde

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