Layout Builder Extra Templates
This module enhances Drupal's Layout Builder by providing additional theme suggestions. These suggestions allow you to use a single template for both custom and inline blocks of the same block type, based on the active theme's name. This simplifies theming by ensuring consistent template availability across different block implementations.
During the rebuild of inviqa.com and inviqa.de onto Drupal 8 and whilst using Layout Builder, we noticed that the same template suggestions weren’t available to both custom and inline blocks of the same block type.
This module adds extra, generic theme suggestions based on the name of the active theme - that apply to both inline and custom blocks, so you can have one template that applies to both!
Examples
Custom block suggestions
Before:
0 => "block__block_content"
1 => "block__block_content__3a7871ce_3f9c_4d2b_b05d_e8ee08840e87"
After:
0 => "block__block_content"
1 => "block__bartik__basic"
2 => "block__block_content__3a7871ce_3f9c_4d2b_b05d_e8ee08840e87"
3 => "block__bartik__block_content__basic"
Inline block suggestions
Before:
0 => "block__layout_builder"
1 => "block__inline_block"
2 => "block__inline_block__basic"
After:
0 => "block__layout_builder"
1 => "block__inline_block"
2 => "block__bartik__basic"
3 => "block__inline_block__basic"
4 => "block__bartik__inline_block__basic"