My website contains project for following categories-

  1. C language
  2. Java language
  3. Shell script

I have a custom content type "project", which has these fields as radio button. I have a menu item in main menu called project, which has above three categories as sub menu item. I want whenever I add any "C language" project, it should automatically attach as a sub menu item of "C language".

How to achieve it?

  • 1
    Automatically adding items to menu could be done in hook_entity_presave with menu_link_save function. In that case you just need to update the links in case category changes. Is there any reason you not to just inject them from views in theme functions (drupal.stackexchange.com/questions/9154/…)? – user20301 Mar 4 '14 at 18:48
  • @user20301: Can you please explain me little more? Also I didn't get that what do you mean by "just inject them from views in theme functions". Is there any other way to achieve my requirement? – Ravi Joshi Mar 5 '14 at 10:46

You could make links list attachment with views for each taxonomy term and then add them in theme_menu_link function if the link in variables matches. Note that requires customization in template.php

|improve this answer|||||

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.