Postponed
Project:
Menu Node API
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Jan 2011 at 17:18 UTC
Updated:
29 Mar 2012 at 14:28 UTC
In D7, due to alter hooks, the following code can be considered naiive, and needs a refactor:
/**
* Implements hook_menu_link_insert().
*/
function menu_node_menu_link_insert($link) {
if ($link['router_path'] != 'node/%' || !isset($link['mlid'])) {
return;
}
$nid = str_replace('node/', '', $link['link_path']);
if ($node = node_load($nid)) {
menu_node_record_save($node, $link);
}
}
This is because modules may alter the canonical router_path of entities.
We may also need to refactor the update hook to ensure that the router_path is still viable on update.
Comments
Comment #1
joglin commentedMenu module has the same bug.
Comment #2
agentrickardYeah, I think this is a warning more than anything else. I haven't actually seen an instance where this bug has bitten anyone.