Remove reliance on the module provided template

Created on 2 June 2024, 24 days ago
Updated 8 June 2024, 18 days ago

Problem/Motivation

Currently the D10 version of this module provides a menu template via a theme suggestion, the issue with this is for many sites the menu markup will likely be built from the theme thus the classes aren't being automatically added. Of course they can be, by adding the 'menu_name_class' variable but this feels like it should be happening automatically.

Steps to reproduce

1. Fresh D10
2. Latest version of this module
3. Enable this module

Check the standard primary menu classes

Expected: The item names are in as classes
Actual: Nothing, because the standard Olivero template is used for the main menu

Proposed resolution

Swap the menu_css_names_preprocess_menu implementation to add classes via attributeds rather than requiring the module template

From
$items[$menu_id]['menu_name_class'] = _make_class_name($items[$menu_id]['title']);

To
$items[$menu_id]['attributes']['class'] = _make_class_name($items[$menu_id]['title']);

Also some cleaning up:

  1. Remove menu_css_names_theme as it shouldn't be needed anymore
  2. Remove menu_css_names_theme_suggestions_menu_alter as it shouldn't be needed anymore
  3. Remove the module template
✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom aaron.ferris

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024