I've got a view of nodes, displayed as fields. As each node may have references to multiple terms/tags, I would like to show all these tags.

When I use field "term_node_tid", then I get the multiple values properly displayed in one row separated by commas. But instead of the readable term, I need the term-IDs.

So I set up another field using "tid", but now only the ID of the first term is shown. There's no multiple value field setting, where I could tweak things. Any help much appreciated.


Change field Formatter

If you're showing the actual Content field you can change the Formatter. Instead of using Label use Entity ID under Formatter.

This will output Term IDs instead of term names, and all the Multi-valued settings will apply the same way as for the names output.

Rewrite results with TID replacement token

Another way or changing the field output in D8 views (if the Formatter option isn't available for example) is to use the Rewrite results > Override the output of this field with custom text and enter the token for the TID in there. You can look up the correct token pattern under Replacement patterns below the Text area.

That is also how you would get the TID to display instead of the name if you use the field Content: All taxonomy terms.

| improve this answer | |
  • neither the formatter option is available, nor rewriting like {{ tid }} reveals all values … I can't believe this standard task isn't a no-brainer. Maybe I am missing something? – Madam Adam Dec 14 '18 at 23:51
  • Can you post more information and screesnhots about your configuration? For example the field settings for term_node_tid, multivalue and rewrite results? – prkos Dec 15 '18 at 3:30
  • It is unbelievable: in order to make screenshots I built the view from scratch and the options for multi-value fields and ID-formatter just appeared. Realy don't know what happened before. – Madam Adam Dec 15 '18 at 12:46
  • It's a well-known issue in programming that sometimes software starts behaving erratically with no reason :) Or maybe it's a case of "It’s harder to read code than to write it". Do you still have the original views? You can compare it to the new one and find out where the "ghost" is. – prkos Dec 15 '18 at 21:48
  • unfortunately, I deleted the old view… – Madam Adam Dec 16 '18 at 19:11

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.