Hi everybody,
I am developing several custom modules for a website I am building. One of the modules is a hardly adapted taxonomy_menu_module which uses vocabulary-names and term-names to create the paths, and some custom functions to render lists of nodes of a taxonomy-term.
For example a part of the menu looks like this
fruits
+-apples
+-peaches
+-berries
+-strawberries
+-.
+-.
+-.
+-.
if the user navigates through this menu the active menu-items are rendered active. But if the user chooses a node to view, the corresponding menu-item is not rendered as active.
in hook_nodeapi/view I compute the correct path for the node and do something like this: (for example $path="berries/strawberries"
)
$arr = array(array('path' => $path, 'title' => t($term->name)), array('path' => 'node/'. $node->nid, 'title' => $node->title));
menu_set_location($arr);
This will expand the menu-hierarchy the right way, but it will not hilight the last menu-item. Say I am viewing a node of the listing strawberries, the menu-item strawberries gets not activated, only expanded.
I can achieve what I want with the following lines:
menu_set_location($arr);
$breadcrumb = drupal_get_breadcrumb();
menu_set_active_item($path);
drupal_set_breadcrumb($breadcrumb);
but I am loosing the local_tasks-menu (view/edit/revisons) of the node, so no easy editing for the user/admins.