Projet

Général

Profil

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

root / drupal7 / sites / all / modules / views / handlers / views_handler_filter_boolean_operator_string.inc @ 6eb8d15f

1
<?php
2

    
3
/**
4
 * @file
5
 * Definition of views_handler_filter_boolean_operator_string.
6
 */
7

    
8
/**
9
 * Simple filter to handle matching of boolean values.
10
 *
11
 * This handler checks to see if a string field is empty (equal to '') or not.
12
 * It is otherwise identical to the parent operator.
13
 *
14
 * Definition items:
15
 * - label: (REQUIRED) The label for the checkbox.
16
 *
17
 * @ingroup views_filter_handlers
18
 */
19
class views_handler_filter_boolean_operator_string extends views_handler_filter_boolean_operator {
20
  function query() {
21
    $this->ensure_my_table();
22
    $where = "$this->table_alias.$this->real_field ";
23

    
24
    if (empty($this->value)) {
25
      $where .= "= ''";
26
      if ($this->accept_null) {
27
        $where = '(' . $where . " OR $this->table_alias.$this->real_field IS NULL)";
28
      }
29
    }
30
    else {
31
      $where .= "<> ''";
32
    }
33
    $this->query->add_where_expression($this->options['group'], $where);
34
  }
35
}