function views_handler_sort_menu_hierarchy::query in Views (for Drupal 7) 6.2
Same name and namespace in other branches
- 6.3 handlers/views_handler_sort_menu_hierarchy.inc \views_handler_sort_menu_hierarchy::query()
- 7.3 handlers/views_handler_sort_menu_hierarchy.inc \views_handler_sort_menu_hierarchy::query()
Called to add the sort to a query.
Overrides views_handler_sort::query
File
- handlers/
views_handler_sort_menu_hierarchy.inc, line 12
Class
- views_handler_sort_menu_hierarchy
- Sort in menu hierarchy order.
Code
function query() {
$this
->ensure_my_table();
$max_depth = isset($this->definition['max depth']) ? $this->definition['max depth'] : MENU_MAX_DEPTH;
for ($i = 1; $i <= $max_depth; ++$i) {
$this->query
->add_orderby($this->table_alias, $this->field . $i, $this->options['order']);
}
}