I'm setting up a new Drupal site and created a content type, taxonomy, and two menus. The taxonomy just has 2 items, which correspond to the menus. What I'd like to do is render the corresponding menu in a sidebar when the user is viewing a node from the content type, ideally highlighting the current item in the menu.
My current thinking is to write a custom module and use the hook_page_build. Then in that hook, see if arg(0)
is 'node' and arg(1)
is numeric and then node_load
arg(1)
and then if that node's type matches my content type, then field_get_items
to get the node's taxonomy and pull the corresponding menu and then add it to $page['sidebar_first']
.
Is this the right approach or is there a better way?
Thanks in advance!