This must be simple, but I can't find how to do it ..

Say I have a custom content type of 'staff' which, among other, has an entity reference field linked to a taxonomy vocabulary which has the terms: 'type A', 'type B', 'type C'.

How can I display some custom text according to which term the content type belongs to?

for example, if 'John Doe' of content type 'staff' belongs to 'type A', I want that field to be displayed as 'Director' and not 'type A'.

I don't want custom text for each individual, I would like to display 'Director' for all 'type A' staff, 'Manager' for all 'type B' staff and 'Administration' for all 'type C' staff..

I would prefer to solve this via core modules and not touching code, if possible. If not possible, then is there a lightweight module to achieve this?


  • Is there a reason "Type A" does not, or cannot, equal "Director"? Vocabularies/Taxonomies are easy to create... – Prestosaurus Jan 30 '18 at 17:02

Change the text of your terms to the actual text you want to display. "Type A" should be "Director". Then just show that field on the content type via the Display Settings.


Add fields to your taxonomy terms. Add a field such as "Staff Position" and then print that field in your template file

{{ node.field_reference.entity.field_staff_position.0.value }}
  • I thought of doing this - but it won't help. Probably my example was not good, in reality I have a more complicated vocabulary and I do need to alter the text shown, I can't have suitably named terms. – thomas Jan 30 '18 at 17:11
  • Hmm... I might suggest then doing some twig text replacing in a template file. twig.symfony.com/doc/2.x/filters/replace.html. Would not require much logic, and would apply specifically to the content type at hand. – Prestosaurus Jan 30 '18 at 17:15
  • OK - thanks for your help and quick response. I thought it would be able to control this easily through some selection in core, but if not, I 'll look to implement your suggestion. I 'll leave this open for a bit before choosing yours as the right answer. Thanks again. – thomas Jan 30 '18 at 17:23
  • Yeah no problem. I updated my answer. – Prestosaurus Jan 30 '18 at 17:39
  • Also you can create field position as second field in your taxonomy term and in display you can hide other fields and allow only position field (basically you can set display per your needs). – StevanRS Jan 31 '18 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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