3

I have a menu tree with links all directing to 'front'.

On creating content I don't want to create a new menu item but want to have an extra option under the Menu settings saying 'Add content to existing menu item'.

What is the best way to achieve this or is there a module available that handles this situation (D7)?

1
  • 1
    Do you mean you want to overwrite the URL of the existing menu item with the new content's URL? And what is the context for doing this? Oct 3 '12 at 18:47
1

I guess you have to write a custom module. This may be a similar situation.

1
  • I do not want to add a link because the links are allready there so both questions have nothing in common. I think I would be more something like a hook_form_alter on the node/add forms but I'm a little lost on how to approach the menu tree.
    – JurgenR
    Mar 28 '12 at 16:42
1

I think you need just go to admin panel -> Structure -> Menus. Find the menu you want to add the link to and and hit "List links" Then find the menu item you want to link content to and hit "edit", and change it's url from to the url of corresponding content.

1
  • I want to link to an existing menu item on the node/add form before saving the node instead of searching in the menus after saving the new node.
    – JurgenR
    May 2 '12 at 6:26
1

Default Drupal behavior allows you to create a new link, under a menu tree item of your choice, at the time of saving a node, as below. adding node menu link at time of node creation

Have I understood right? - What you want to do is, be able to select a menu tree item, just like in the above image, but not have to enter title and description etc. You don't want new menu item created, but use the existing one, and have its path value changed from front to the path of the new node?

^ If that is the case, you have to create a quick custom module to do so. A good idea would be to form alter (the fields, the submission behavior) the same form in the image above. That way you do not have to code the menu tree loading and selecting parts etc.

Hope this helps.

1

Your solution is the Menu editor module. Make sure you enable the me_node_creation submodule.

You create the menu links as placeholders, with <new> as the link path. Then on visiting any such item, you get to a page that allows you to create a real node attached to this menu link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.