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

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

Mitsuko created an issue. See original summary.

mitsuko’s picture

Issue summary: View changes
mitsuko’s picture

Issue summary: View changes
anruether’s picture

Thanks for figuring this out! This solves my issue from #3273601: Dropdown not working for toolbar_menu menus

anruether’s picture

Status: Active » Reviewed & tested by the community
anruether’s picture

StatusFileSize
new540 bytes

Uploading as patch to be used in projects.

mitsuko’s picture

Hi anruether,

Thank you for your feedback.

For information, you can get the patch by clicking on "plain diff" in the Issue Fork frame (it's a little bit too discreet).

anruether’s picture

@Mitsuko Yes, but the MR can change. When using a patch in a project I want it to be stable. However, we can hide the patch so it is clear that work is done in the MR.

  • zipme_hkt committed c3aaa0d4 on 8.x-1.x
    #3230506 Menu Depth > 1 not shown for users for user without permission...
zipme_hkt’s picture

Status: Reviewed & tested by the community » Fixed
zipme_hkt’s picture

Status: Fixed » Closed (fixed)