"Add child" link is removed without checking permissions

Created on 25 June 2025, 9 days ago

Problem/Motivation

When this module is enabled, even an administrator account (with all permissions) does not see the "Add child" links when editing a menu.

The "Add child" links were added in Drupal 10.2, so all supported versions of Drupal core have them.

Steps to reproduce

  1. Install Drupal with the Umami installation profile. I tested with the 10.4.x development branch.
  2. Install and enable the simple_menu_permissions module.
  3. Log in as an administrator.
  4. Visit a page like /en/admin/structure/menu/manage/account.
  5. Look for the drop buttons with the "Add child" links.

Proposed resolution

In Drupal\simple_menu_permissions\Form\MenuForm::form(), make the code match the comment:

        // Remove the "Add child" button if the user does not have the permission to add new links.
        if (isset($form['links']['links'][$key]['operations']['#links']['add-child'])) {
          unset($form['links']['links'][$key]['operations']['#links']['add-child']);
        }

Remaining tasks

User interface changes

Before

API changes

None

Data model changes

None

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024