public function views_handler_filter_boolean_operator::query in Views (for Drupal 7) 7.3
Same name and namespace in other branches
- 6.3 handlers/views_handler_filter_boolean_operator.inc \views_handler_filter_boolean_operator::query()
- 6.2 handlers/views_handler_filter_boolean_operator.inc \views_handler_filter_boolean_operator::query()
Add this filter to the query.
Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.
Overrides views_handler_filter::query
3 methods override views_handler_filter_boolean_operator::query()
- views_handler_filter_boolean_operator_string::query in handlers/
views_handler_filter_boolean_operator_string.inc - Add this filter to the query.
- views_handler_filter_tracker_boolean_operator::query in modules/
tracker/ views_handler_filter_tracker_boolean_operator.inc - Add this filter to the query.
- views_handler_filter_user_current::query in modules/
user/ views_handler_filter_user_current.inc - Add this filter to the query.
File
- handlers/
views_handler_filter_boolean_operator.inc, line 188 - Definition of views_handler_filter_boolean_operator.
Class
- views_handler_filter_boolean_operator
- Simple filter to handle matching of boolean values
Code
public function query() {
$this
->ensure_my_table();
$field = "{$this->table_alias}.{$this->real_field}";
if (empty($this->value)) {
if ($this->accept_null) {
$or = db_or()
->condition($field, 0, '=')
->condition($field, NULL, 'IS NULL');
$this->query
->add_where($this->options['group'], $or);
}
else {
$this->query
->add_where($this->options['group'], $field, 0, '=');
}
}
else {
if (!empty($this->definition['use equal'])) {
$this->query
->add_where($this->options['group'], $field, 1, '=');
}
else {
$this->query
->add_where($this->options['group'], $field, 0, '<>');
}
}
}