Menu Depth > 1 not shown for users for user without permission 'show administration menu in the toolbar'

Created on 30 August 2021, about 3 years ago
Updated 23 August 2023, about 1 year ago

Problem/Motivation

If a user/role (other than uid 1) don't have the permission 'show administration menu in the toolbar', nested menus do not work.
The top level is rendered, but sub levels are not visible.

@see: https://www.drupal.org/project/toolbar_menu/issues/2949053#comment-12681327

Steps to reproduce

  1. Install toolbar_menu and toolbar_menu_clean modules
  2. Create a nested menu with toolbar_menu to replace "administration menu" for a specific role
  3. Give the permission to see your new menu (toolbar_menu) and remove permission 'show administration menu in the toolbar' (toolbar_menu_clean)

Proposed resolution

As suggested in this issue for the toolbar_menu module, change the line 36 in toolbar_menu_clean.module file :

unset($items['administration'])
by
$items['administration']['#wrapper_attributes']['class'] = 'visually-hidden';

Merge toolbar_menu and toolbar_menu_clean ?

I discover the toolbar_menu_clean project from this issue on toolbar_menu project. Clearly, toolbar_menu_clean is an important complement to toolbar_menu to provide a good "editor" or "webmaster" experience ! IMHO, 2 project are related and thing will be easier if it was only one project (maybe with a submodule).

🐛 Bug report
Status

Fixed

Version

1.3

Component

Code

Created by

🇫🇷France mitsuko

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024