I have a content type (appel_offre) with a field_categorie_avis field, which is a list type with these values.

  • ouvert | Ouvert toute l'année
  • restreint | Restreint 24h
  • concurrence | Appel public à concurrence

In the node--appel-offre.html.twig template, I want to print this field but I only get the key, not the value. For example, for Appel public à concurrence, I always get concurrence.

I am using node.field_categorie_avis.value. Is there another way to get the same value?

  • what does it spit out if you use dump() on the field?
    – Amy
    Commented Dec 29, 2016 at 20:07
  • Hello and happy new years !
    – lchabrand
    Commented Jan 2, 2017 at 0:29
  • Happy New year to you too!
    – Amy
    Commented Jan 4, 2017 at 15:57

2 Answers 2


You can use

{{ content.field_categorie_avis[0]['#markup'] }}

to display label.

Dont miss the [0] because drupal always store items in array in case of field size limit change.

  • Very useful. I was struggling with this for last couple of hours. Commented Apr 25, 2018 at 11:26
  • This did not work for me in Drupal 8.9. Instead, use: element['#object'].field_name.setting('allowed_values')[element['#object'].field_name.value]
    – komlenic
    Commented Apr 23, 2021 at 20:53

Came across this same issue, none of the proposed solutions worked... in a node template what worked was:


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.