You are here

Cool module: Simple Hierarchical Select

I have seen so many questions online about how to get hierarchical taxonomy terms to display better as views filters or to content editors who have to work with them.

So my first 'cool module' blog will be to show you how to use this module!  It's simple, and unlike some of its predecessors works only with hierarchical terms.

  1. Download and enable the Simple hierarchical select module
  2. There is no configuration screen or any setup to do once you've enabled it.  It's functionality includes the fact that you will now have an additional option to select the new 'simple hierarchical select' option when
    • setting up term reference fields or
    • term reference views filters.
  3. Enabling simple hierarchical select for your content type's hierarchical term reference fields
    • I have a vocabularly called 'Blog topic' on a content type already, and when I am creating a new blog node, my term reference field 'Blog topic' looks like this by default (note the little dashes that denote child terms -- we're all familiar with this default display):
    • Go back to the 'Manage fields' tab for your content type and hit the 'Select list' or other type you have in the 'Widget' column of your term reference field.
    • If you have enabled the module properly, this will bring up the widget selection screen, and you should see the new 'Simple hierarchical select' option listed:
    • Now when I, or a content editor creates or edits a blog post, the term field will look much better! 
      Note that the hierarchy is clearly displayed.  At first, the author sees only the top level terms (with the number of nodes tagged with the term in parentheses).  After you make a selection from the top level, the child options are loaded and displayed dynamically!
  4. Once you've changed the widget type, go back and hit 'Edit' next to the term field to see what additional options the field will have.  You can
    • make it mandatory for an author to make a selection from the deepest level of the vocabulary (so, in the case above, it would not be OK to select 'Cool modules' but then leave the actual module unselected)
    • display the number of nodes associated with each term
    • allow the creation of new terms (like tags do)
    • and more!
  5. If you're creating a new term reference, rather than changing the widget for an existing one, you'll see all these options as it takes you through the configuration screens!
  6. Finally, you'll notice that if you add this field as an exposed filter in a view, you'll get a brand new option when configuring the selection type: 'Simple hierarchical select'.  Make sure you use that if you want to display the filter in the same way as demonstrated above!

 

Share

Comments

How can you views you have the checkbox for children

Did you try checking the 'Unlimited' option for the 'Number of values' field setting?  That may be all you need...

Yes, I want my children to have multiple selections.
Do you take the children to the Checkbox is displayed?
How can I do this??????

Hamed,

Unfortunately your options for this aren't perfect.  

  • Option 1 is to simply use the regular 'Check boxes/radio buttons' widget type for your field (rather than the 'Simple hierarchical select' option I'm describing below).  If you use that widget type and check the field settings to allow for multiple (or unlimited) values, rather than just one, it will automatically display as checkboxes:
  • Option 2 is to stick with the 'Simple hierarchical select' widget type that I describe above and again, make sure you select the 'Unlimited' option for the 'Number of values' field setting.  However, for this widget type, rather than displaying checkboxes, it will simply let your content editors 'Add another item' one by one.

    If you select the above, your content editor will be able to add as many term references as they want, but they will have to add them all individually - they can't do them easily by checking all the boxes together:

Here is why neither option is perfect:

  • Option 1 shows checkboxes, but the hierarchy is very poorly displayed.  Also, with Option 1, folks could check parent items - and not be forced to choose child items.
  • Option 2 shows the hierarchy very well (especially for a complicated or long hierarchy!!), and you can choose, when setting up the field, to have the user select children from teh deepest level (rather than parents) if that is what you want.  BUT, it won't let you choose multiple options easily via check boxes - you have to add separate options one by one.  

These imperfect options are the only ones you have, as far as I can tell.  If someone else has found an alternate module, hopefully they will chime in here. 

Thank you.
Another Question
Is it that the views theming do it and only on the checkboxe to have children?
Or modules that can do this job?
You can introduce a film about me?
I am very, very grateful.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.