I have a Drupal menu called Top-Nav which I use for my Top Navigation with the following 6 menu items(for example)

Home   a    b    c    d    e

Each of a, b, c, d and e have sub items. I also have 5 other menus let's say named "menu1", "menu2", "menu3", "menu4", "menu5" that have exactly the same structure/items as a, b, c, d, e Like "menu1" is the same as "a", "menu2" is the same as "b" ...

What I am trying to achieve is the following: When the admin adds a new item to "a" section of Top-Nav i want to replicated that item in "menu1" programmatically, I want to sync them once the new link is added.

2 Answers 2


My suggestion is to use hook_form_FORM_ID_alter to add a custom submit handler. In that submit handler, you will get the current menu item values. Use those values to create a new menu item for the other menu.

Functions to use:

  1. hook_form_FORM_ID_alter. Here form id will be 'menu_edit_item'
  2. Use form['#submit'][] = "custom submit handler" in form alter.
  3. Use menu_link_save in custom submit handler based on the values you get form the form_state.

You can use the hook_menu_link_insert in a custom module.

This hook is used to notify modules that menu items have been created. Contributed modules may use the information to perform actions based on the information entered into the menu system.


$link: Associative array defining a menu link as passed into menu_link_save().

I make a test and it's works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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