The filter at the top of the animal asset screen (Records → Assets → Animal) includes a field for Species/breed. I have setup my Taxonomy to have the species (like Chicken) with breeds under the species, like this:
What I have noticed is that when I select “Chicken” in the species/breed filter field, it doesn’t show any animal assets since no animals are actually listed as simply “chicken” but instead their actual breed. I have to select each “leaf” term individually.
I would like the filter to include any the lower level taxonomy terms. I currently have 13 different species of chickens on my farm, so it would be much easier for me to see all my chickens if I could just select “Chicken” and have it display every species that is under the Chicken hierarchy.
Yea this has come up before - I agree! It’s a shame that Drupal’s default Views filter handler for terms doesn’t offer that option out of the box (we’re just using the functionality that comes with Drupal for this).
I did a quick search and found this:
Might be possible to implement in the farm_ui_views module (which provides the default farm_asset Views).
I suppose it’s worth posing the question: are there cases where you would NOT want it to work this way? Because if we make this change, it essentially removes the ability to filter down to assets that ONLY have the parent term.
One other thought… another way to achieve the desired filtering might be to simply reference multiple terms on the same asset. For example, tag the animal asset with BOTH “Chicken” AND “Barred Rock” terms. This essentially uses a data convention to achieve the desired functionality instead of a technical solution.
Unfortunately, that isn’t currently possible with Animal assets, because they only allow a single “Animal type” term to be referenced. Other asset types like Plant allow multiple. So we could consider changing Animal assets to allow multiple as well.
Not suggesting this is the right solution, just adding it as one to consider.
From a technical implementation standpoint, in order to filter by all child terms, we would need need to load the IDs of all child terms and include those in the SQL WHERE condition.
As I understand it the “Has taxonomy terms (with depth)” would allow us to say “include child terms up to N levels deep” in the filter configuration.
AFAIK the “Has taxonomy terms (with depth)” filter does not provide that option. But it’s worth trying it out in a local environment to see what it does/doesn’t do and report back here. Perhaps we could extend it just slightly in our own custom handler to add that checkbox you described @Symbioquine.