You are here

function views_menu_children_sort_handler::query in Views Menu Node Children Filter 7

Called to add the sort to a query.

Overrides views_handler_sort::query

File

includes/views_menu_children_sort_handler.inc, line 31

Class

views_menu_children_sort_handler

Code

function query() {

  // figure out if the needed join is already applied via the potential existence of the views_menu_children_filter.
  $target_menu = $this
    ->hasAttachedContextFilter();
  if (empty($target_menu)) {
    $target_menu = $this->options['target_menu'];
  }
  \views_menu_children_argument::joinMenuLinksTableToNode($this->query, $target_menu);
  $this
    ->ensure_my_table();

  // Add the field.
  $this->query
    ->add_orderby($this->table_alias, $this->real_field, $this->options['order']);
  $this->query
    ->add_orderby($this->table_alias, 'link_title', $this->options['order']);
  $this->query
    ->add_orderby($this->table_alias, 'mlid', $this->options['order']);
}