Theme suggestions still in the wrong order (at least a bit) [beta3 / 2.x custom theme conflict]

Created on 20 August 2022, over 2 years ago
Updated 17 February 2023, almost 2 years ago

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

🐛 Bug report
Status

Closed: won't fix

Version

2.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024