How to add suggestions of block templates for block type in Drupal 8 and Drupal 9

Drupal 8 and Drupal 9 add suggestions of block templates for the different block types by using the hook_theme_suggestions_block_alter() function in the .theme file.

For example, if you want to create a block template for a specific type like block--bundle--machine_name_of_block_type.html.twig. For basic block type naming convention will be block--bundle--basic.html.twig. For banner block type naming convention will be block--bundle--banner.html.twig.
copy-icon

Comments

Authors

Read Next