I'm new in drupal and I would like to add a link Projects to the main navigation menu:

  • Projects

      proj 1
      proj 2
      proj n

This link projects with a drop down menu with N links. Until now I can have this drop down menu but statically.

Q1. I would like to generate this drop down list dynamically. For example if I have 10 projects, the drop down menu will have 10 links. Is there a way to plug into the menu a drop down list result of a view? or a select list but in the menu?

Q2. For each project in the drop down menu, I would like to point to a page sending the node id of this selected node (the page have some block views). So I can use this node id in the contextual filters for the views I have in the pages. Is there a way to do this? Thank you

| improve this question | | | | |
  • You could consider creating a taxonomy vocab called "Projects", with terms such as proj_1, proj_2 etc - and then use the drupal.org/project/taxonomy_menu to create them as menus. However this module gives you a taxonomy vocab as a separate menu block, so it won't quite integrate fully with the main menu. – 100pic Jan 7 '19 at 21:37

Q1. The module Menu Views allows you to "insert" views results in place of one menu item.

Q2. You'll need Views Contextual Filter Query and apply it to the views blocks you have on your pages.

Then you need to construct the links that have the project node id in query so it can be picked up by views on pages. The easiest way to do that is probably with Views. Create a new view listing pages, with Link to content as a field but override it to append the project id query, limit results to 1, details depend on your particular case, you haven't included enough info about the connections between projects and pages and possible other configuration.

| 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.