Invalid file name suggestions when menu name contains a dash

Created on 23 April 2025, 2 days ago

Problem/Motivation

When a user-created menu machine name contains a dash, openy_carnation_theme_suggestions_menu_alter will generate a suggestion with that dash. There is a longstanding core issue, πŸ› hook_theme_suggestions_alter does not work for hyphens Active around that not being handled well.

In that case, the site will throw an error in the twig suggestions:

<!-- INVALID FILE NAME SUGGESTIONS:
   See https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!theme.api.php/function/hook_theme_suggestions_alter
   menu__mybroken-menu__header_top_right
-->

Steps to reproduce

- Enable Carnation and twig debugging
- Create a menu with dashes in the machine name
- Check the comments.

Proposed resolution

Clean the dashes.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

3.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States froboy Chicago, IL

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024