Menu item extras templates and suggestions are only enabled for menus with fields

Created on 23 January 2024, 11 months ago

Problem/Motivation

Menu item extras template suggestions are only enabled for menus with custom fields.

Steps to reproduce

  • Create a menu with no fields
  • Add a display mode to the menu
  • Enable twig debugging
  • Confirm that no menu item extra template suggestions are available

Notes

The current behavior is that a menu link content entity must have a custom field for menu item extras templates and suggestions to be applicable.

@see \Drupal\menu_item_extras\Utility\Utility::checkBundleHasExtraFieldsThanEntity
@see \menu_item_extras_preprocess_block()
@see \menu_item_extras_preprocess_menu()
@see \menu_item_extras_theme_suggestions_menu()

Proposed resolution

OPTION 1:
Check if a menu has display modes and allow menu item extras templates and suggestions to be applicable.

OPTION 2:
Check if a menu is not locked (aka not an admin or devel menu) and allow menu item extras templates and suggestions to be applicable.

OPTION 3:
Leave the AS-IS and require a field to be added to allow menu item extras templates and suggestions to be applicable.

Remaining tasks

  • Determine the best option
  • Create MR
  • Review MR
  • Merge MR

User interface changes

N/A

API changes

Possibly adding new utilities including Utility::checkBundleHasExtraViewModes

Data model changes

N/A

✨ Feature request
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

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

Comments & Activities

Production build 0.71.5 2024