How to Pass Variables into Twig Templates in Drupal


Drupal Academy published a tutorial that explains how to pass the variables to The Tweak templates from the custom block. 

The video also explains reasons to create these custom tweak templates to display the data. Watch the 15 minute Youtube Video by Drupal Planet to learn the following.

  • How to pass variables into twig templates in Drupal 9 | Drupal 10 | Drupal 8?
  • How to pass array data to twig templates in Drupal 9 | Drupal 10 | Drupal 8?
  • How to display data in twig template?
  • How to loop through in twig template?


Drupal Academy is a community of Drupal learners, educators, and professionals dedicated to advancing the skills and knowledge of Drupal, an open source content management platform.

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please let us know in the comments below and we will try to address the issue as best we can.

Related Organizations

Advertisement Here

Upcoming Events

Latest Opportunities

Advertisement Here