I create mousemade pixel perfection stuffs for the interwebs.

Published: 6 years ago

Drupal taxonomy term jump menu with optgroup for 1st level

Recently I had to create a jump menu in views, listing all terms in a vocabullary. Terms were of maximum 2 levels.

This is how I did it:

  1. Create a view with “Jump Menu” style
  2. Add Term Name & Tid fields
  3. Add Taxonomy Term:parent relationship
  4. Add one more Taxonomy:Term Name field, using the relationship just created. Choose this field as grouping field in Jump menu settings.
  5. Add a filter Taxonomy:Term Name using the same relationship, with the operator “Is not equal to”. Keep the operator value empty.

That will create a jump menu with first level terms as <optgroup> items.

Leave a Reply

Some HTML is OK