/[drupal]/contributions/modules/views/handlers/views_handler_filter_boolean_operator_string.inc
ViewVC logotype

Contents of /contributions/modules/views/handlers/views_handler_filter_boolean_operator_string.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Tue Sep 15 16:18:38 2009 UTC (2 months, 1 week ago) by merlinofchaos
Branch: MAIN
CVS Tags: DRUPAL-6--2-7, HEAD
Branch point for: DRUPAL-6--2, DRUPAL-7--3
Changes since 1.1: +13 -2 lines
File MIME type: text/x-php
#508124 by voxpelli: Optionally allow boolean to treat NULL as FALSE.
1 <?php
2 // $Id: views_handler_filter_boolean_operator_string.inc,v 1.1 2008/12/16 19:12:27 merlinofchaos Exp $
3 /**
4 * Simple filter to handle matching of boolean values.
5 *
6 * This handler checks to see if a string field is empty (equal to '') or not.
7 * It is otherwise identical to the parent operator.
8 *
9 * Definition items:
10 * - label: (REQUIRED) The label for the checkbox.
11 */
12 class views_handler_filter_boolean_operator_string extends views_handler_filter_boolean_operator {
13 function query() {
14 $this->ensure_my_table();
15 $where = "$this->table_alias.$this->real_field ";
16
17 if (empty($this->value)) {
18 $where .= "= ''";
19 if ($this->accept_null) {
20 $where = '(' . $where . " OR $this->table_alias.$this->real_field IS NULL)";
21 }
22 }
23 else {
24 $where .= "<> ''";
25 }
26 $this->query->add_where($this->options['group'], $where);
27 }
28 }

  ViewVC Help
Powered by ViewVC 1.1.2