0

How can I create a menu link for main-menu which has related subitems?

For example in main-menu I have Home About Products and for the Products menu item I want it to put all categories as subitems: Products -> Shoes -> Shirts ...

Is there a hook or an example so you can achieve this?

1
  • plz expand details
    – monymirza
    Commented Mar 25, 2013 at 11:10

3 Answers 3

1

You can create a menu programatically through menu hooks, and a great source for sample code and explanation is the menu_example portion of the Examples Module. You can also set up new menu items and strcutre through Drupal's admin menus management (admin/structure/menus)

0

In Your exaple You can use Taxonomy Menu module ;) It transform taxonomy vocabularies structure into menu tree.

But if You want to do this programmatically (but why?) the best way is to look at Example Module or other implementations of hook_menu and creating your own module.

-1

Why you want to do it programmatically? You can use GUI for it and use Superfish or similar module to display drop down menu and subitems?

2
  • I want to create it programmatically because I have multiple instances and I don't want to use GUI every time I add a new menu item.
    – bogtan
    Commented Apr 9, 2013 at 12:41
  • Doesn't matter why. Thats the question. There are myriad reasons why programatically is the only option. Consider these questions as comments and not answers in future.
    – Christian
    Commented Jul 3, 2014 at 6:25

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.