Skip to main content
Drupal Architect

Main navigation

  • Modules
  • Articles
  • Resources
  • Questions
  • Projects
  • Tips
  • Issues
  • Changes
  • Topics
  • Search

Breadcrumb

  1. Home
  2. Articles

Twig Templating

Posted October 19, 2024 | Updated October 20, 2024

Twig is Drupal's templating language, coming from Symfony.

https://twig.symfony.com/
https://www.drupal.org/docs/develop/theming-drupal/twig-in-drupal

Print variables with {{ variable }}.

Templates end in .html.twig.

SDC components end in .twig.

https://www.drupal.org/docs/develop/theming-drupal/using-single-directory-components/creating-a-single-directory-component

Drupal adds extra twig functions.
https://www.drupal.org/docs/develop/theming-drupal/twig-in-drupal/functions-in-twig-templates

Drupal adds extra twig filters.
https://www.drupal.org/docs/develop/theming-drupal/twig-in-drupal/filters-modifying-variables-in-twig-templates

Some recent additions.
https://www.drupal.org/node/2818293
https://www.drupal.org/node/3334294

Theme suggestion hooks.
https://www.drupal.org/node/2100775

Tags
#Twig
Tips
Merge twig attributes with object

Footer

  • About
  • Learn
  • Contact

Social

  • Classes
  • Portfolio
  • Twitter
  • Mantra Theme