function views_handler_filter_boolean_operator::query in Views (for Drupal 7) 6.3
Same name and namespace in other branches
- 6.2 handlers/views_handler_filter_boolean_operator.inc \views_handler_filter_boolean_operator::query()
- 7.3 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_upload_fid::query in modules/
upload/ views_handler_filter_upload_fid.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 146
Class
- views_handler_filter_boolean_operator
- Simple filter to handle matching of boolean values
Code
function query() {
$this
->ensure_my_table();
$where = "{$this->table_alias}.{$this->real_field} ";
if (empty($this->value)) {
$where .= '= 0';
if ($this->accept_null) {
$where = '(' . $where . " OR {$this->table_alias}.{$this->real_field} IS NULL)";
}
}
else {
if (!empty($this->definition['use equal'])) {
$where .= '= 1';
}
else {
$where .= '<> 0';
}
}
$this->query
->add_where($this->options['group'], $where);
}