function admin_menu_element_sort in Administration menu 6.3
Same name and namespace in other branches
- 8.3 admin_menu.module \admin_menu_element_sort()
- 7.3 admin_menu.module \admin_menu_element_sort()
Function used by uasort to sort structured arrays by #weight AND #title.
1 string reference to 'admin_menu_element_sort'
- theme_admin_menu_links in ./
admin_menu.module - Render a themed list of links.
File
- ./
admin_menu.module, line 695 - Render an administrative menu as a dropdown menu at the top of the window.
Code
function admin_menu_element_sort($a, $b) {
// @see element_sort()
$a_weight = is_array($a) && isset($a['#weight']) ? $a['#weight'] : 0;
$b_weight = is_array($b) && isset($b['#weight']) ? $b['#weight'] : 0;
if ($a_weight == $b_weight) {
// @see element_sort_by_title()
$a_title = is_array($a) && isset($a['#title']) ? $a['#title'] : '';
$b_title = is_array($b) && isset($b['#title']) ? $b['#title'] : '';
return strnatcasecmp($a_title, $b_title);
}
return $a_weight < $b_weight ? -1 : 1;
}