Download & Extend

Show hierarchy in the taxonomy terms

Project:Jump
Version:6.x-2.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

Hi Marcp

Thank you for coming up with this simple and wonderful module.
Is it possible to make the terms in the pull-down menu show in a hierarchical format.
That is, child terms will have a hyphen '-' in front.
See attached screen shot of the Taxonomy menu from Taxonomy Browser module.

Thank you.

Gui

AttachmentSize
taxonomybrowser.jpg14.1 KB

Comments

#1

Try replacing the line in the function jump_menu_get_taxo_options() that says:

    $options[taxonomy_term_path($term)] = $term->name;

with:
    $options[taxonomy_term_path($term)] = str_repeat('-', $term->depth) . $term->name;

...and let us know how it goes.

I'd like to generalize this out and make it easier to theme, but this is a start.

#2

hi marcp

it works!

thank you.

gui

#3

subscribing, and verifying this works as described.

It would be nice if the parents could be bolded, currently trying to figure this out.

#4

Status:active» needs review

Hi marcp,
It's an old issue - and i often use Quick Menu instead (maybe would be good to merge efforts @ some point?).
Anyway, for now Jump has taxonomy support (unlike Quick Menu)... and the taxonomy list works better with your suggestion in #1
attaching a patch :)

AttachmentSize
jump_315416_tax_hierarchy.patch 650 bytes

#5

Status:needs review» reviewed & tested by the community

Confirming that the patch in #4 works like a charm. Correctly filters and displays hierarchical terms in Jump dropdown. You can see the proof in the pudding: http://www.cctcvambridge.org/welcome

Ready to be committed.

I'm about to open up a second issue for adding user prefs on how the Jump menu should be displayed.

#6

Thanks Scott. Patch worked for me.

#7

Version:6.x-1.0» 6.x-2.x-dev
Status:reviewed & tested by the community» needs work

This feature didn't get into 1.x. We are glad to accept a new patch against 2.x branch.

#8

Here is my version of jump_menu_get_taxo_options, which takes the top level taxonomy items and makes groups out of them to contain their children:

function jump_menu_get_taxo_options(&$options, $vid) {
   $tree = taxonomy_get_tree($vid);
   foreach ($tree as $term) {
     if (!$term->depth)
       $option_group = $term->name;
     if ($term->depth)
       $options[$option_group][taxonomy_term_path($term)] = str_repeat(' ', $term->depth) . $term->name;
   }
}

#9

@nathan573,

Thanks for posting this snippet to the issue queue. For taxonomy vocabularies without any parent terms, the jump menu does not display any options.

I also noticed that when using this snippet and selecting a jump menu, it triggers the admin menu to expand.

I'll post back if I solve anything.

Thanks, jwant.

#10

Would it be possible for a similar function/ feature to exist for the hierarchy of normal menus too so that the second level links are visible?

nobody click here