You are here

function views_handler_sort_null_field::query in Views Sort Null Field 7

Called to add the sort to a query.

Overrides views_handler_sort::query

File

./views_handler_sort_null_field.inc, line 43

Class

views_handler_sort_null_field
Sort handler for NULL values on FieldAPI fields.

Code

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

  // Make an alias.
  $alias = implode('_', array(
    $this->table_alias,
    $this->real_field,
    'isnull',
  ));

  // Add the field.
  $this->query
    ->add_orderby(NULL, "{$this->table_alias}.{$this->real_field} IS NULL", $this->options['order'], $alias);
}