So what I am trying to do, is to get all the blocks in footer region to use the same template, say, block--footer-block.html.twig
.
What I tried is to use hook_theme_suggestions_HOOK_alter()
to check where the blocks are located and add the region name to the template suggestions.
/**
* Implements hook_theme_suggestions_HOOK_alter().
* */
function mytheme_theme_suggestions_block_alter(array &$suggestions, array
$variables {
$block = Block::load($variables['elements']);
$region = $block->getRegion();
$suggestions[] = 'block . '__' . $region . '__block';
}
Currently the $block->getRegion();
breaks my site - no idea why. It doesn't even give any errors, the site is just blank.
Is this even a good way of doing this?
This was answered here: https://drupal.stackexchange.com/questions/192616/how-to-make-a-theme-hook-suggestion-for-blocks-according-to-region