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
CommentFileSizeAuthor
#6 AfterMR.png60.96 KBanirudhsingh19
#6 BeforeMR.png69.8 KBanirudhsingh19
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

berliner created an issue. See original summary.

berliner’s picture

Issue summary: View changes
berliner’s picture

Status: Active » Needs review

Th MR does the changes proposed in the issue description, tests are still passing.

anirudhsingh19’s picture

reviewing this!

anirudhsingh19’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new69.8 KB
new60.96 KB

I 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.

zengenuity’s picture

Status: Reviewed & tested by the community » Fixed

Merged. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

zengenuity’s picture

This is now part of the 2.1.1 release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.