Same name and namespace in other branches
  1. 4.7.x includes/menu.inc \_menu_sort()
  2. 5.x includes/menu.inc \_menu_sort()

Comparator routine for use in sorting menu items.

5 string references to '_menu_sort'
menu_overview_tree_rows in modules/menu.module
menu_parent_options in modules/menu.module
Return a list of menu items that are valid possible parents for the given menu item.
_menu_append_contextual_items in includes/menu.inc
Account for menu items that are only defined at certain paths, so will not be cached.
_menu_build_local_tasks in includes/menu.inc
Find all the items in the current local task tree.
_menu_build_visible_tree in includes/menu.inc
Find all visible items in the menu tree, for ease in displaying to user.

File

includes/menu.inc, line 734
API for the Drupal menu system.

Code

function _menu_sort($a, $b) {
  $menu = menu_get_menu();
  $a =& $menu['items'][$a];
  $b =& $menu['items'][$b];
  return $a['weight'] < $b['weight'] ? -1 : ($a['weight'] > $b['weight'] ? 1 : ($a['title'] < $b['title'] ? -1 : 1));
}