Setting menu trails based on taxonomy by default
| Project: | Menu Trails |
| Version: | 6.x-1.0 |
| Component: | Documentation |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Hi folks,
Here is what I'm trying to achieve, I'd like to know if it is possible with this module or whether I'm going to have to hand code something.
I currently have the primary links set as the top level of my taxonomy and the secondary links set as the second level of the same taxonomy. The remaining levels will be navigable through the breadcrumb and other manually created links.
Car
-Audi
--A3
--A4
-BMW
--X3
--X5
Motorbike
etc
The initial problem was that the secondary links were shown only when navigating the taxonomy pages, as soon as I view a node the secondary links vanish. This module fixes this problem but seemingly only if I assign each node with a parent item which ends up being identical to the single taxonomy term already associated with the node. I'd really like the module to simply use the single taxonomy term to save me having to select it for the hundreds of nodes that I already have. Is it possible?

#1
I modified the module code as follows to achieve what I am after:
function menutrails_nodeapi(&$node, $op, $a3 = NULL, $page = FALSE) {
if ($op == 'view' && $page == TRUE) {
// $item = menutrails_node_location($node);
if(is_array($node->taxonomy)) {
$term = array_shift($node->taxonomy);
}
$item = menu_get_item();
$item['href']="taxonomy/term/".$term->tid;
if ($item) {
menu_set_item(NULL, $item);
if (variable_get('menutrails_breadcrumbs', 1)) {
drupal_set_breadcrumb(menutrails_get_breadcrumbs());
}
}
}
}
I'm sure there must be a more elegant solution or a better place for this function but I've not developed enough in Drupal to know where.