2

I am using Drupal 8. I have a hierarchical taxonomy vocabulary like this (simplified):

Animals
-Vertebrates
--Fishes
---Butterflyfishes
----Chevron Butterflyfish

On a taxonomy term's page, I automatically get the ancestral tree as breadcrumbs. For example, on drupal/Butterflyfishes I see this:

Animals >> Vertebrates >> Fishes

If I add Butterflyfishes as a Taxonomy term entity reference on a content page (i.e. not the taxonomy term's page itself), how can I also display such an ancestral tree on that content page?

2 Answers 2

1

2 possible solutions: a) programmatically via an own custom module providing a custom formatter or via a custom theme function. Or b) via contrib modules providing a field formatter to view the whole term path instead of only the end point (default).

In your case I assume you ask for the second. The module Hierarchical select used to provide this view widget (field formatter) in D7 and maybe alternative modules like SHS or CSHS in D8 will provide it? If not, you can try to work with the Custom formatter module, which enables you to build own formatters in admin UI without creating own modules for this purpose. It comes with examples showing how it works, and it can be used even if the user has no advanced module development knowledge.

1
  • Thanks @jbitdrop. I am open to either (a) or (b), but favour a solution that does not require much coding knowledge, both for myself and for others that may find this page. Simple Hierarchical Select seems promising but the instructions are for D7 only, and I have not been able to make it work so far. Custom Formatters also looks promising but some coding required. This example custom formatter may be a start. More advice on any method would be welcome.
    – Nick Hope
    Commented Dec 2, 2017 at 16:07
1

https://www.drupal.org/project/hierarchical_term_formatter, https://www.drupal.org/project/shs and https://www.drupal.org/project/cshs all provide this functionality.

1
  • Thank you. The Hierarchical Term Formatter module appears to be what I was looking for when I asked this question, but I am currently not in a position to test it.
    – Nick Hope
    Commented Mar 24, 2021 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.