Problem/Motivation
Reported by Drupal (10.5) in the generated HTML source:
<!-- INVALID FILE NAME SUGGESTIONS:
See https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!theme.api.php/function/hook_theme_suggestions_alter
form_options_attributes__select__options_attributes
-->
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!theme.api.... states:
New suggestions must begin with the value of HOOK, followed by two underscores to be discoverable.
That means that the suggestion should started with the theme hook it extends, and not with the module name as is currently the case.
Proposed resolution
Rename:
- the theme implementation from
form_options_attributes__select__options_attributes to select__form_options_attributes
- the associated template file from
form-options-attributes--select--options-attributes.html.twig to select--form-options-attributes.html.twig
- the preprocess function from
form_options_attributes_preprocess_form_options_attributes__select__options_attributes to form_options_attributes_preprocess_select__form_options_attributes
Comments
Comment #3
berliner commentedComment #4
berliner commentedTh MR does the changes proposed in the issue description, tests are still passing.
Comment #5
anirudhsingh19 commentedreviewing this!
Comment #6
anirudhsingh19 commentedI installed the module on D10 and can confirm the issue exists (See the screenshot). For reproducing the issue, I created a custom module and a new select field in a form. I applied the MR and issue was fixed. Hence, moving to RTBC.
Comment #8
zengenuity commentedMerged. Thanks!
Comment #10
zengenuity commentedThis is now part of the 2.1.1 release.