Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We have a script which relies on details being passed back from node_save -- e.g. the nid -- but this is not honored by the menu module. This patch changes this so that the mlid is passed back to the calling routine. This fixes our problem, and hasn't caused any unwanted effects for us, but I don't know enough about the internals of the menu system to say for sure.
Thanks,
Tom
P.S. Comment attached from original developer:
/**
*
* GJP: 7/8/2008
* I have changed the line below to an =& assignment so that when menu_link_save() is called later
* the changes it makes are actually reflected in the $node object.
*
* This is useful to scripts that wish to create menu items for nodes and then know the menu-link id
* immediately without looking them up manually.
*
*/
Comment | File | Size | Author |
---|---|---|---|
#2 | menu.module_7.x.mlid_.patch | 870 bytes | grendzy |
menu.module.patch | 398 bytes | karaken12 | |
Comments
Comment #1
grendzy CreditAttribution: grendzy commentedThis patch makes sense to me -- though I'm still having trouble getting the mlid after the node form is submitted. I'm using a form callback like this:
Are you using nodeapi to get the mlid?
also, see this related issue:
#326210: (Needs tests) menu_submit & mlid on menu creation
Comment #2
grendzy CreditAttribution: grendzy commentedHere's a patch for 7.x.
Comment #4
grendzy CreditAttribution: grendzy commentedperhaps a victim of #335122: Test clean HEAD after every commit
Comment #5
pwolanin CreditAttribution: pwolanin commentedthis looks reasonable - they might be other ways to formulate the fix, but the basic principle that all modified elements of the node are present in the object coming out of node_save() seems correct.
Comment #6
grendzy CreditAttribution: grendzy commentedThis has been merged into #326210: (Needs tests) menu_submit & mlid on menu creation.