I recently needed to create a view of type “Term” that displayed taxonomy terms and their description for certain vocabulary.
The setup for that was quite simple:
- Create a taxonomy view
- Choose the vocabulary in the filter
- Add the description field
This gave me the list of all the terms under the vocabulary.
But, the view has to show only the parent terms or the top-level terms in the vocabulary hierarchy.
I instantly went looking for a depth modifier filter or argument handler, but no such luck, you just can’t restrict to a level in the hierarchy.
Then, it struck me that a term with no parent is the top-level term or parent term based on the
With this assumption, it was fairly simple to get the parent terms
- I added a relationship -
- Under filter criteria added
Taxonomy term: Term ID
- Added the
Is Empty (NULL)under operator
Voila. I got the parent terms under the vocabulary.