function votingapi_views_handler_sort_nullable::query in Voting API 7.3
Same name and namespace in other branches
- 6.2 views/votingapi_views_handler_sort_nullable.inc \votingapi_views_handler_sort_nullable::query()
- 7.2 views/votingapi_views_handler_sort_nullable.inc \votingapi_views_handler_sort_nullable::query()
Called to add the sort to a query.
Overrides views_handler_sort::query
File
- views/
votingapi_views_handler_sort_nullable.inc, line 29 - Provide a views handlers for votingapi data fields.
Class
- votingapi_views_handler_sort_nullable
- @file Provide a views handlers for votingapi data fields.
Code
function query() {
$this
->ensure_my_table();
// Add the field.
if ($this->options['coalesce']) {
$this->query
->add_orderby(NULL, "COALESCE({$this->table_alias}.{$this->field}, 0)", $this->options['order'], $this->table_alias . '_' . $this->field . '_coalesced');
}
else {
$this->query
->add_orderby($this->table_alias, $this->real_field, $this->options['order']);
}
}