You are here

function flag_handler_sort_flagged::query in Flag 7.2

Same name and namespace in other branches
  1. 7.3 includes/views/flag_handler_sort_flagged.inc \flag_handler_sort_flagged::query()

Called to add the sort to a query.

Overrides views_handler_sort::query

File

includes/flag_handler_sort_flagged.inc, line 38
Contains the flagged content sort handler.

Class

flag_handler_sort_flagged
Handler to sort on whether objects are flagged or not.

Code

function query() {
  $this
    ->ensure_my_table();

  // Add the ordering.
  // Using IS NOT NULL means that the ASC/DESC ordering work in the same
  // direction as sorting by flagging date: empty results come first.
  $this->query
    ->add_orderby(NULL, "({$this->table_alias}.uid IS NOT NULL)", $this->options['order']);
}