function _nodehierarchy_save_menu_link in Node Hierarchy 7.2
Same name and namespace in other branches
- 6.3 nodehierarchy.module \_nodehierarchy_save_menu_link()
- 6.2 nodehierarchy.module \_nodehierarchy_save_menu_link()
Save a menu link with changes if needed.
2 calls to _nodehierarchy_save_menu_link()
- _nodehierarchy_create_node_menu_link in ./
nodehierarchy.module - Get the menu link for the given node.
- _nodehierarchy_save_node in ./
nodehierarchy.module - Do the actual insertion or update. No permissions checking is done here.
File
- ./
nodehierarchy.module, line 1174 - A module to make nodes hierarchical.
Code
function _nodehierarchy_save_menu_link(&$menu_link) {
// Item is being moved to a new parent.
$old_plid = _nodehierarchy_get_plid_from_mlid($menu_link['mlid']);
if ($old_plid !== (int) $menu_link['plid']) {
// Get the next weight for the new parent.
$menu_link['weight'] = _nodehierarchy_get_menu_link_next_child_weight($menu_link['plid']);
}
// Save the parent
menu_link_save($menu_link);
// Create the link reference.
_nodehierarchy_create_nodehierarchy_menu_link_reference($menu_link);
}