- Guides & Documentation
Knowledgebase
Featured articles, how-to guides and quick tips.
Setting a Variable in Twig - Drupal 8
It's easy to set a variable in a Twig template in Drupal 8.
Just follow the instructions below.
{% set foo = entity.field_something.value %}
Now you can print the field as so:
{{ foo }}