function menu_node_menu_link_update in Menu Node API 7
Implements hook_menu_link_update().
File
- ./
menu_node.module, line 27 - Menu Node API Manages relationships between the {node} and {menu_links} table.
Code
function menu_node_menu_link_update($link) {
if ($link['router_path'] != 'node/%') {
// new link is NOT attached to a node
if (menu_node_get_node($link['mlid'])) {
// old link WAS attached to a node: menu_node record need to be deleted:
menu_node_record_delete_by_link($link);
}
}
else {
// new link IS attached to a node
$nid = str_replace('node/', '', $link['link_path']);
if ($node = node_load($nid)) {
menu_node_record_save($node, $link);
}
}
}