You are here

function nodehierarchy_menu_nodehierarchy_reorder_children in Node Hierarchy 7.4

Implements hook_nodehierarchy_reorder_children().

File

nodehierarchy_menu/nodehierarchy_menu.module, line 221
Create menu items for a node based on the Node Hierarchy.

Code

function nodehierarchy_menu_nodehierarchy_reorder_children($items) {
  $updated = FALSE;
  foreach ($items as $item) {
    if ($menu_link = _nodehierarchy_menu_get_node_record_menu_links($item)) {
      if ($menu_link['weight'] != $item->cweight) {
        $menu_link['weight'] = $item->cweight;
        menu_link_save($menu_link);
        $updated = TRUE;
      }
    }
  }
  if ($updated) {
    menu_cache_clear_all();
  }
}