Download & Extend

Menu trail based on parent taxonomy terms

Project:Menu Trails
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

Hello,
I'd be grand to be able to set a few parent terms in a vocab, and then if a node has a child-term selected, the menu trail could form based on that path.

For instance, say your taxonomy hierarchy was:
Tech
-Computers
-Audio Players
-Etc
Print
-Books
-Magazines
-Etc Etc

You could set where Tech and Print belong in the menu, and a node that uses the Audio Player term would appear under Tech's menu trail.

Comments

#1

Subscribing!

#2

+1

#3

Status:active» needs review

Patch attached. This also includes the fix in #547634: Bug in parent assignment via taxonomy term causes parent assignment via node type to fail

AttachmentSize
menutrails_term_parents_375832.patch 1.7 KB

#4

Patch doesn't seem to work for deeper hierarchies:

For such a hierarchy
Life
--Animals
----Mammal
------Cat
------Dog
----Fish
------Piranha
------Goldfish
----Bird
------Eagle
------Sparrow

and having set in the Menu Trails configuration>Categories:Life
Parent item for Animals>none
Parent item for Mammal>Animals
Parent item for Cat>none

when I am visiting a node tagged as Cat, only Animals is active and not Mammal also as it should. The breadcrumbs also shows:
Home › Animals ›

#5

Tri: thanks for the review! It sounds like the patch is working as intended; the breadcrumbs represent your menu hierarchy, rather than the taxonomy.

Perhaps the http://drupal.org/project/taxonomy_breadcrumb module will help with your problem.

#6

this patch didn't work for me as it should because
if (!empty($node->taxonomy))
has always been empty, no matter what node I was viewing.
so I added the functionallity to manually get the nodes' taxonomy.

I changed:

   if (!empty($node->taxonomy)) {
     foreach ($node->taxonomy as $term) {
     ...

to this:

    $taxonomy = taxonomy_node_get_terms($node);
    if (!empty($taxonomy)) {
      foreach (array_reverse($taxonomy) as $term) {
      ...

in menutrails.module.

And now it works.