You are here

function _admin_menu_sort in Administration menu 5.3

Same name and namespace in other branches
  1. 5.2 admin_menu.module \_admin_menu_sort()

Comparator routine for use in sorting menu items.

4 string references to '_admin_menu_sort'
admin_menu_add_item in ./admin_menu.module
Add a custom menu item.
admin_menu_build in ./admin_menu.inc
Rebuild administration menu links.
admin_menu_move_item in ./admin_menu.inc
Moves the child pointer of a menu item to a new parent.
_admin_menu_get_children in ./admin_menu.inc
Recursively adds items to the administration menu.

File

./admin_menu.module, line 484
Render an administrative menu as a dropdown menu at the top of the window.

Code

function _admin_menu_sort($a, $b) {
  $_admin_menu = admin_menu_get_menu();
  $a = $_admin_menu[$a];
  $b = $_admin_menu[$b];
  if ($a['weight'] < $b['weight']) {
    return -1;
  }
  elseif ($a['weight'] > $b['weight']) {
    return 1;
  }
  elseif (isset($a['title']) && isset($b['title'])) {
    return strnatcasecmp($a['title'], $b['title']);
  }
  else {
    return 1;
  }
}