You are here

function menu_node_views_sort_menu::query in Menu Node Views 7

Same name and namespace in other branches
  1. 6 includes/menu_node_views_sort_menu.inc \menu_node_views_sort_menu::query()
  2. 7.2 includes/menu_node_views_sort_menu.inc \menu_node_views_sort_menu::query()

Called to add the sort to a query.

Overrides views_handler_sort::query

File

includes/menu_node_views_sort_menu.inc, line 10
Views sort handler for the menu hierarchy.

Class

menu_node_views_sort_menu
@file Views sort handler for the menu hierarchy.

Code

function query() {
  $this
    ->ensure_my_table();
  $start_depth = isset($this->options['start_depth']) ? $this->options['start_depth'] : 1;
  $max_depth = !empty($this->options['max_depth']) ? $this->options['max_depth'] : MENU_MAX_DEPTH;
  for ($i = $start_depth; $i <= $max_depth; $i++) {
    $this->query
      ->add_orderby($this->table_alias, "p{$i}", $this->options['order']);
  }
}