One of our members wanted to create a taxonomy of Countries, Provinces and Districts.
For example, you might choose England, then Yorkshire, then Leeds. Or you might choose Canada, then Ontario, then Toronto. You get the idea.
In this tutorial, we'll use the Hierarchical Select module to make that happen.
Step #1. Get set up
First, you need to set up your taxonomy. I've a simple example here with Countries and Cities, but you'll probably add a lot more terms.
Next, install and enable Hierarchical Select: https://www.drupal.org/project/hierarchical_select
Make sure to enable "Hierarchical Select Taxonomy":
Step #2. Create the field
- Go to Structure > Content types > Manage fields.
- Create a new field. Choose "Term Reference" and then "Hierarchical Select":
- Save the field.
- Click the "Hierarchical Select" link.
You'll now see a series of options for the field:
- Save lineage: Save all term levels (City and Country) or just the one the user chooses.
- Level choice: What level can a user choose from? Only City? Other other levels too?
Under "Level labels" you can give labels to the different levels of the taxonomy:
Under "Dropbox settings", you can decide how many choices a user can make:
And under "Editability settings", you can decide whether the user can add new terms and levels to our set-up:
Step #3. Use the field
Finally, click "Add content" and use your field. Here's how the top level will look:
And, once the first level has been selected, here's how the second level will look: