An idea came up recently that I wanted to capture for discussion…
Problem
If you use the taxonomy term hierarchy features to organize your terms, and you want the parent name included in the child name, you need to duplicate this manually in the child term’s name.
Example
Imagine organizing the “Plant type” taxonomy so that the top-level terms are broad types (eg: “Tomato”), and child terms are varieties (eg: “Yellow Cherry”, “Brandywine”, “Mike’s Specialty Heirloom”, etc).
- Tomato
- Brandywine
- Yellow Cherry
- Mike’s Specialty
The problem is that when you’re looking at a Plant asset you only see the child term (eg: “Brandywine”), and sometimes this can be less helpful or ambiguous (eg: is this my “Brandywine” tomato plant or my “Brandywine” raspberry plant?)
The workaround right now is to include the parent name in the child name manually (eg: call it “Brandywine Tomato”). This works, but it makes the hierarchy feel more verbose than it needs to be…
- Tomato
- Brandywine Tomato
- Yellow Cherry Tomato
- Mike’s Specialty Heirloom Tomato
Solution?
One potentially easy solution would be to override the Taxonomy Term’s label()
output, and tack on the hierarchy automatically. For example:
Term label = “[Term Parent Label] > [Term name]”
This label gets used in most places in the farmOS UI, so it would effectively automate inclusion of the parent term everywhere.
Considerations
This may be useful in some contexts, but not in others. It should probably be configurable, down to the taxonomy-type level. Maybe you want this for “Plant Type” terms, but not for “Units” terms.
Also, adding this to a site with existing hierarchies could lead to disruption for users, if all of a their term labels change suddenly. We could avoid this by only enabling this behavior on new farmOS instances. Existing instances could have the option of turning it on, but may want to clean up their terms first.