You are here

function _menu_breadcrumb_sort in Menu Breadcrumb 6

Same name and namespace in other branches
  1. 7 menu_breadcrumb.module \_menu_breadcrumb_sort()

Sort-by-weight comparison. Sub-sort by menu_name, for consistency in the settings form.

1 string reference to '_menu_breadcrumb_sort'
_menu_breadcrumb_process_new_menus in ./menu_breadcrumb.module
Helper for _menu_breadcrumb_get_menus(). Compare new menus against the defined menu patterns, and update the persistent variable caches accordingly.

File

./menu_breadcrumb.module, line 256
The main file for the menu_breadcrumb module.

Code

function _menu_breadcrumb_sort($menu1, $menu2) {
  $menu1_weight = !empty($menu1['weight']) ? $menu1['weight'] : 0;
  $menu2_weight = !empty($menu2['weight']) ? $menu2['weight'] : 0;
  if ($menu1_weight == $menu2_weight) {
    $menu1_name = !empty($menu1['name']) ? $menu1['name'] : "";
    $menu2_name = !empty($menu2['name']) ? $menu2['name'] : "";
    return $menu1_name < $menu2_name ? -1 : 1;
  }
  return $menu1_weight < $menu2_weight ? -1 : 1;
}