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.twigTHEME/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.
Comments
Comment #2
quietone commentedChanges 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.
Comment #3
liam morlandI have observed this on Drupal 10.4. It seems likely that the problem exists on later versions but I can't easily test that.