Hi there,

I wonder if it is possible to use different level labels with HS, depending on the term which is selected. Maybe an example will help to understand the idea:

I have the following taxonomy tree "Things I like":

+ Cars
   + BMW
      + 3 Series
         - 318i
         - 325i
      + 7 Series
         - 745i
   + Mercedes
      - A Class
      - S Class
+ Locations
   + Spain
      - Barcelona
      - Madrid 
   + France
      - Paris

So when displaying this in a hierarchical select widget, where a user can choose from any level, I would like to have a label "Manufacturer", when selecting "Cars" (and a label "Series" when a manufacturer is selected). When selecting "Locations" there should be a label "Countries" displayed (and a label "Citys" when a country is selected).

When I use the level label option, i can only have one label per level. Is it possible to have more?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Status: Active » Postponed (maintainer needs more info)

1) Where would this "dynamic label" be positioned?
2) Despite your efforts, I still don't know what you mean exactly. Please try to be very exact :)

no2x’s picture

Hi wim,

ok I'll try it with screenshots.

ad 2)
Look at "select-level-1.png". The label for Level 1 is "--Things I like...". If you choose an option, level 2 is activated (see screenshots "select-level-2-cars.png" and "select-level-2-locations.png"). The label for Level 2 should be "--Manufacturer..." in the case of Cars and "--Countries..." in the case of Locations. I think this is not possible in the moment with HS 6.x-3.1?

ad 1)
I'm not sure where those can be positioned in the Config UI. Now there is an option "Level labels" in the Config UI (Root level, Sublevel 1,...) -> see screenshot "config-level-labels.png". When these labels are dynamic, this option doesn't make sense (as you can only define one label per level. Maybe in the case of HS Taxonomy it could be an option on the Taxonomy terms creation page (admin/content/taxonomy/1/add/term) - below the Term and the Description textfields?!

klonos’s picture

Title: Different level labels depending on taxonomy term » Different level labels depending on taxonomy parent term

I think I understand what you are after, but I believe that it is not doable at the moment. As for how much work it needs in order to be implemented, I think that Wim is the right person to answer that one.

If I get this right, you need some sort of 'conditional labels' for each level depending on the parent item @ lvl1. You want to display something different as a label for lvl2 depending on what was chosen in lvl1. Right?

So, if item in lvl2 is a car, you want the label to display 'Brand' and if it is a location, you want it to display 'Country'. Same in lvl3 if a car, then display 'Series' and if a location then 'City'. Right? The way I see it you should perhaps divide cars and locations into two different vocabularies. What you are asking in other words (the way I see it) is for HS drop-down to actually display two different vocabularies in one menu and the labels to adapt in order to reflect the correct label for each level per vocabulary.

I personally find no use for it and I think it will be hard to implement. Again, the right person to judge this is Wim.

PS: To give some credit to the idea, I thing that this would be useful when trying to cut down on the amount of choices presented to a user. If no2x chooses to go another way as a workaround, the user will have to make a choice for each thing he likes (referring to the example in the description). So, instead of simply 'Things I like:', there would have to be 'Cars I like:' and 'Locations I like:' and so on for each single thing they like. Plus if they don't like some things, there would have to be a 'none' item in each vocabulary.

...what a mess you've managed to get yourself into no2x? When things turn out to be this complicated, there usually is a simpler way to do it, but people simply haven't yet thought of it. I will look for any alternative ways to achieve what you are after and let you know.

no2x’s picture

Hi klonos,

thanks for your answer. it is exactly how you described it - the level label depends on the particular parent term.

Let me loose some words on your suggestion to split that into two vocabularys (and accordingly into two HS widgets). The "Things I like" is only an example to describe the needed function. I think of complex vocabularys like a spare parts classification with maybe 5 or 10 levels of hierarchy. It would be very user-unfriendly to have lots of HS widget in an exposed form, where you'll have to choose your parts. And maybe this will event not be possible as the classification is hierarchical and a selection on a deeper level depends on a selection on a higher level.

I can imagine that this may be hard to implement - maybe Wim can comment on this.

klonos’s picture

Status: Postponed (maintainer needs more info) » Active

Setting this back to active then...

So he can just do that ;)

Wim Leers’s picture

Version: 6.x-3.1 » 6.x-3.x-dev
Component: Code - Taxonomy » Code
Category: support » feature
Status: Active » Postponed

This will indeed not be for HS 3. This would make the code even less understandable. Sorry.

Wim Leers’s picture

Issue tags: +HS4

Tagging for HS4. Included in the HS4 roadmap: http://drupal.org/node/1052670.

klonos’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev

This will happen in the 7.x branch.

BR0kEN’s picture

Issue summary: View changes
Status: Postponed » Needs review
FileSize
3.7 KB
211.16 KB

Labels per level

Dead-simple patch for hser. The label for the first select is the label of the field, for the second - what's configured, for third - none, because not added.

BR0kEN’s picture

FileSize
4.15 KB
1.71 KB

Remove labels when the first select box has no value (no select boxes for the nesting levels are presented, but the labels persist).

BR0kEN’s picture

FileSize
490 bytes
4.22 KB

Resolved the problem adding a label to new select boxes.