logo

Extra Block Types (EBT) - New Layout Builder experienceâť—

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

âť—Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll
13/04/2025, by Ivan

About Twig

Twig is a compiled template language based on PHP. When your web page is rendered, the Twig engine takes the template and converts it into a "compiled" PHP template, which is stored in a secure directory at sites/default/files/php/twig. Compilation happens once, template files are cached for reuse, and recompiled when the Twig cache is cleared.

The Drupal Twig initiative shares the same motivation as Symfony’s: to introduce a modern, powerful, object-oriented engine that allows developers to properly focus on Drupal.

13/04/2025, by Ivan

When working with a Twig template file, most variables are documented in the file’s comments. However, when they’re not, or when themes or modules introduce new variables, we need a way to discover all available variables within the template scope. Twig provides the dump() function for inspecting variables in templates.

The dump() function will not output anything unless debugging is enabled. Learn how to enable Twig debugging.

13/04/2025, by Ivan

How Twig Normally Works

By default, the Twig theming engine compiles templates into PHP code and stores the compiled code in memory. This compiled code is not ideal for development because changes to Twig templates do not immediately reflect on your Drupal site.

Once Twig finishes rendering markup, the Render API adds another layer of caching. It stores the markup created by Twig in such a way that Twig is not involved in subsequent page requests, effectively ignoring Twig debugging settings.

13/04/2025, by Ivan

To find out which template is generating the markup for a specific element, you can use Twig’s built-in debug option. This setting will display HTML comments alongside the rendered output, which includes the theme hooks used, suggested template file names, and identifies the exact Twig file used to render a specific part of your markup.