function radioactivity_node_views_handler_sort_left_or_inner::query in Radioactivity 6
File
- plugins/
radioactivity_node_views_handler_sort_left_or_inner.inc, line 36 - Node radioactivity views handler to allow choosing between LEFT or INNER joining.
Class
- radioactivity_node_views_handler_sort_left_or_inner
- @file Node radioactivity views handler to allow choosing between LEFT or INNER joining.
Code
function query() {
if ($this->options['join_type'] == 'inner') {
// inner join: no coalesce workaround required
parent::query();
return;
}
// NOTE:
// In Radioactivity, NULL energy (i.e. no energy row per node) is equivalent
// to 0 energy. So, add the sort key accordingly.
$this
->ensure_my_table();
$this->query
->add_orderby(NULL, 'COALESCE(' . $this->table_alias . '.' . $this->field . ',0)', $this->options['order'], $this->table_alias . '_' . $this->field . '_sortkey');
}