Problem/Motivation

I was working with a theme that contained these template files:

  • THEME/templates/view/views-view-unformatted--research_story_list--block_card.html.twig
  • THEME/templates/view/views-view-unformatted--research-story-list--block-card.html.twig

The names differ only in their use of hyphen vs. underscore. One site used one file while another site used the other. I was trying to debug why the site, running the same code, displayed things differently. This should not happen.

Proposed resolution

Sort the template candidate filenames before replacing hyphen with underscore so that behaviour is consistent. See comments in theme_get_suggestions().

Remaining tasks

Implement.

User interface changes

None.

Introduced terminology

None.

API changes

None except that behavior will be consistent.

Data model changes

None.

Release notes snippet

Comments

liam morland created an issue. See original summary.

quietone’s picture

Version: 10.4.x-dev » 11.x-dev

Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies.

Drupal 10 is in maintenance mode with a limited set of allow changes.

liam morland’s picture

I have observed this on Drupal 10.4. It seems likely that the problem exists on later versions but I can't easily test that.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.