Drupal and Web Development Tidbits

Twig Field Value

March 6, 2021

Written by: Jon Kamke

The Twig Field Value module that provides some extra Twig filters.

Recently discovered the Twig Field Value module that provides some extra Twig filters. Possibly the most useful is the field_value that renders the string value of the field instead of the entire field array.

You can check for a field value with an if statement like

{% if content.field_some_field_name | field_value %}

Filters:

Go to the project page https://www.drupal.org/project/twig_field_value to find out more.

Twig

Contrib

Modules