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.
 *
 */
CommentFileSizeAuthor
#2 menu.module_7.x.mlid_.patch870 bytesgrendzy
menu.module.patch398 byteskaraken12
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

grendzy’s picture

This 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:

$form['#submit'][] = '_my_callback_submit';

Are you using nodeapi to get the mlid?

also, see this related issue:
#326210: (Needs tests) menu_submit & mlid on menu creation

grendzy’s picture

Version: 6.4 » 7.x-dev
FileSize
870 bytes

Here's a patch for 7.x.

Status: Needs review » Needs work

The last submitted patch failed testing.

grendzy’s picture

Status: Needs work » Needs review
pwolanin’s picture

this 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.

grendzy’s picture

Status: Needs review » Closed (duplicate)