Closed (won't fix)
Project:
Menu Rules
Version:
7.x-1.1
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Aug 2012 at 16:33 UTC
Updated:
31 Jan 2013 at 14:53 UTC
I have a "section" node that references child pages via an entity reference field.
I am trying to create a rule that will iterate over the referenced child nodes and create a menu item for each of them. This is working fine but I would like these child node menu items to use the parent node's menu link as their parent. Right now the direct input is a select item that can allow me to select the parent, but in this case the parent would be dynamic for every section node that is created.
How can I get a node's menu item so I can set it as the parent?
Comments
Comment #1
ordermind commentedThis is a very special case, so I suggest that you use for example hook_menu_link_alter() to change the link on the fly.
Comment #2
Jack Ellis commentedI solved this by installing the Menu Node API (http://drupal.org/project/menu_node) and then:
Please note that I use a different module to have multiple menu links in the node, so you may not need the array pop.
NOTE: If you're dynamically creating entities (or content), you will need to save the entity straight away to get the node ID. If you have problems with it not working, test and check the error log.
I didn't put too much energy into this post so I apologise if it doesn't make sense!
Whilst I'm here, I'd like to thank the maintainers for this great module!