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

File

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