Block Type Templates

Component ID

2802599

Component name

Block Type Templates

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

5513

Component created

Component changed

Component body

Drupal 8 core does not provide support for block type templates.

This is a very simple way to provide modular design components, affording consistent patterns 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 does by providing the following naming convention:

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

For example, a custom block type with machine name testing_this_out would now have a corresponding Twig template 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.