For the complete documentation index, see llms.txt. This page is also available as Markdown.

3.4 Demonstrate ability to build or override Twig templates for defining layout content

Review how to print variables, how to filter variables, how to structure a template and how to add a template suggestion.

Few changes to note from D7 to D8

  • All template files end in .html.twig.

  • To override a template, add more specificity to the name of your template file to override the default twig template. For example, to override a block template, rename your new file block.html.twig or block--module_name.html.twig

Other Resources

Drupal.org Working with Twig Templates

Last updated