Drupal is a registered trademark of Dries Buytaert
Release: Leaflet 10.4.11 Minor update available for module leaflet (10.4.11). Release: Session Inspector 1.0.8 Minor update available for module session_inspector (1.0.8). Release: Migrate QA 2.0.4 Minor update available for module migrate_qa (2.0.4). Release: CKEditor Description List 3.0.0 Major update available for module ckeditor_descriptionlist (3.0.0). Release: FlowDrop 2.4.0 Minor update available for module flowdrop (2.4.0). Release: JWT Token Refresh 1.0.4 Minor update available for module jwt_token_refresh (1.0.4). Release: ConReg 1.0.0-beta1 First beta version released for module conreg (1.0.0-beta1). Release: AI Image Studio 1.0.0-beta8 New beta version released for module ai_image_studio (1.0.0-beta8). Usage Milestone: Role Theme Switcher Module role_theme_switcher crossed 1,000 active installs. Module Revived: Decoupled Router 2.0.7 Module decoupled_router updated after 11 months of inactivity (2.0.7).

Block Type Templates

943 sites Security covered
View on drupal.org

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

Activity

Tracked releases
1
Tracked since
Jul 2026
Latest release
1 month ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
8.x-1.1 Stable Jul 1, 2026