Projet

Général

Profil

Paste
Télécharger (1013 octets) Statistiques
| Branche: | Révision:

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

1
<?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

    
15
  /**
16
   * Exposed filter options.
17
   */
18
  public $always_multiple = TRUE;
19

    
20
  /**
21
   * Provide simple equality operator.
22
   */
23
  public function operator_options() {
24
    return array(
25
      '=' => t('Is equal to'),
26
      '!=' => t('Is not equal to'),
27
    );
28
  }
29

    
30
  /**
31
   * Provide a simple textfield for equality.
32
   */
33
  public function value_form(&$form, &$form_state) {
34
    $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

    
49
}