0

On node add/edit page we have a menu settings option. This option by default show all the nodes in the main menu under Parent Item tab. Is there a way we can limit the nodes in the menu(under parent item) to only first two levels. enter image description here

  • hook_form_alter() and manually remove any #options more than 2 levels deep? – Felix Eve Apr 30 '15 at 7:17
  • Have a look at drupal.org/project/menu_block and see it it will work for your use case. – J. Reynolds Apr 30 '15 at 14:06
  • @FelixEve while I can do that I was thinking if we can limit it during the menu population itself so that we don't need to waste so many resources. – Gokul N K May 2 '15 at 6:36
0

Menu Performance Module does exactly that.

Drupal is already aware of this issue and has a variable menu_override_parent_selector which can be leveraged by other modules to come up with their own implementation of the menu handlers on node edit page.

As the project page reads

Menuperformance takes advantage of this, and sets the variable when installed. It then proceeds to add its own AJAX based parent menu item selector widgets for the node edit, node type edit and vocabulary edit pages.

How to Use from README.txt

  • Enable the module.
  • Go to /admin/config/user-interface/menuperformance , and activate the module. Checking the checkbox sets Drupal variable menu_override_parent_selector.
  • After the module is activated, the menu item selectors on the above mentioned pages should have been replaced with a multiple dropdown AJAX-powered selector instead of the standard single dropdown.

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.