Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Block Type Templates

Security covered Under active development 905 sites

This module allows you to define custom Twig templates for different types of blocks. It provides a theme suggestion that automatically applies a specific template based on the machine name of your block type, enabling consistent theming for blocks.

Drupal 8 core does not provide support for theme suggestions for custom block type Twig templates.

Having a theme suggestion tied to the type of block is a very simple way to provide modular design components, affording consistent patterns per block type driven through Drupal's block system. This can be used with the standard block placement, Panels, or any other system that leverages blocks. Advanced supported cases include the use of the Components module, which can afford more granular, reusable templates included within other templates.

This module provides the following theme suggestion based on the Twig naming convention:

block--block-content-{{ machine-name-of-block-type }}.html.twig

For example, a custom block type with machine name testing_this_out would now have a corresponding template suggestion for all blocks of that type block--block-content-testing-this-out.html.twig.

The Twig template assumes all of the standard markup found in all other the block templates, including the corresponding fields of that block type.

Note that the Drupal 10.3+ version supports block suggestions by itself. Here is the change record - https://www.drupal.org/node/3304793

Drupal 8–11

Ask your assistant about Block Type Templates

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Jul 2024
Latest release
4 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
8.x-1.1 Stable 8–11 Jul 1, 2026
8.x-1.0 Stable 8–10 Jul 10, 2024
8.x-1.x-dev Dev 8–11 Jul 9, 2024