Hide administration menu links that do not have visible child links

Created on 28 February 2017, almost 9 years ago
Updated 31 July 2023, over 2 years ago

Follow-up to #2855786: Menu items that link to an empty administration page are not hidden โ†’

Problem/Motivation

For users with limited permissions (i.e. content editors), enabling the "access administration pages" permission makes a lot of menu items appear that they don't have access to, which show a "You do not have any administrative items." message.

Having all these links that go nowhere is not a very good UX:

Steps to reproduce

  1. Cleanly install Drupal using the standard profile
  2. Log in as user 1
  3. Visit /admin/people/create
  4. Create a new user and grant them the role
  5. Open a private browser window
  6. Log in as the newly created editor
  7. Once authenticated, change the menu to its vertical orientation mode (either by clicking the toggle button on the right side of the toolbar or by shrinking your window width until the menu hits its responsive page break)
  8. Expand the menu item
  9. Observe that the menu item is visible (it should not be) and click it
  10. You will be directed to an empty system admin menu block page with the text

Proposed resolution

Don't show menu items that go to empty administration pages by checking if children are accessible in addition to checking the "access administration pages" permission.

Remaining tasks

Patch
Review
Commit

User interface changes

Menu items to empty administration pages will be hidden.

API changes

N/A

Data model changes

N/A

๐Ÿ› Bug report
Status

Closed: duplicate

Version

11.0 ๐Ÿ”ฅ

Component
Menu systemย  โ†’

Last updated 5 months ago

Created by

๐Ÿ‡ณ๐Ÿ‡ฑNetherlands stefan.r

Live updates comments and jobs are added and updated live.
  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Merge Requests

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