Problem/Motivation
Update: This issue is caused by our custom theme, the module code is correct so far!
The loading order is wrong in some special cases, which is able to break sites as templates that were in use before are now overridden by block--fences.html.twig.
Actual:
<!-- FILE NAME SUGGESTIONS:
* block--block-questions-overlay.html.twig
* block--block-content--5383d333-7715-4445-95f6-33e90c407e16.html.twig
* block--block-content.html.twig
* block--block-content.html.twig
x block--fences.html.twig
* block--bundle--advanced-block.html.twig
* block.html.twig
-->
Expected:
<!-- FILE NAME SUGGESTIONS:
* block--block-questions-overlay.html.twig
* block--block-content--5383d333-7715-4445-95f6-33e90c407e16.html.twig
* block--block-content.html.twig
* block--block-content.html.twig
x block--bundle--advanced-block.html.twig
* block--fences.html.twig
* block.html.twig
-->
The code we're using is already:
/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function fences_block_theme_suggestions_block_alter(array &$suggestions, array $variables, $hook) {
// Further suggestions MIGHT be added here later, see:
// https://www.drupal.org/project/fences_block/issues/3304737
// Add suggestion above block.html.twig:
array_unshift($suggestions, 'block__fences');
}
so this might be a nasty problem with the module / theme loading order for hook_theme_suggestions_HOOK_alter.
Experienced at flexiB.
Steps to reproduce
Proposed resolution
https://www.drupal.org/project/fences_block/issues/3335715
✨
Add a switch to enable/disable Fences Blocks and its block--fences.html.twig override
Active
Remaining tasks
User interface changes
API changes
Data model changes