views_handler_filter_boolean_operator_string.inc

  1. 3.x handlers/views_handler_filter_boolean_operator_string.inc
  2. 2.x handlers/views_handler_filter_boolean_operator_string.inc

Definition of views_handler_filter_boolean_operator_string.

File

handlers/views_handler_filter_boolean_operator_string.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_handler_filter_boolean_operator_string.
  5. */
  6. /**
  7. * Simple filter to handle matching of boolean values.
  8. *
  9. * This handler checks to see if a string field is empty (equal to '') or not.
  10. * It is otherwise identical to the parent operator.
  11. *
  12. * Definition items:
  13. * - label: (REQUIRED) The label for the checkbox.
  14. *
  15. * @ingroup views_filter_handlers
  16. */
  17. class views_handler_filter_boolean_operator_string extends views_handler_filter_boolean_operator {
  18. function query() {
  19. $this->ensure_my_table();
  20. $where = "$this->table_alias.$this->real_field ";
  21. if (empty($this->value)) {
  22. $where .= "= ''";
  23. if ($this->accept_null) {
  24. $where = '(' . $where . " OR $this->table_alias.$this->real_field IS NULL)";
  25. }
  26. }
  27. else {
  28. $where .= "<> ''";
  29. }
  30. $this->query->add_where_expression($this->options['group'], $where);
  31. }
  32. }