Allow editors to see but not edit level restricted menu links in the node form

Created on 11 August 2025, 3 days ago

Problem/Motivation

Ideally, content editors should still be able to see the menu settings for menu links at restricted levels in the node form but not be able to edit or remove them.

Data model changes

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jastraat

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

Merge Requests

Comments & Activities

  • Issue created by @jastraat
  • πŸ‡ΊπŸ‡ΈUnited States jastraat

    Note that this will only work in Drupal 10. In Drupal 11, Drupal returns AccessResultForbidden for the menu element within the node form based on the access of the existing associated menu link content item. This means that the menu section is fully removed already from the node form.

  • πŸ‡ΊπŸ‡ΈUnited States jastraat
  • πŸ‡ΊπŸ‡ΈUnited States jastraat
  • πŸ‡ΊπŸ‡ΈUnited States cameron prince

    10.5.2 Testing

    Setup:

    (+) Need two roles with admin level permissions + page editing permissions (e.g. admin and content_editor)
    (+) admin role needs the "administer restricted menu levels" permission and content_editor should not have this.
    (+) create a user with the content_editor role
    (+) On /admin/config/user-interface/menu-level-permissions restrict the main navigation menu and select level one only

    Test:

    (+) Admin can add/edit/delete all menu links in node forms at level 1 or level 2.
    (+) Editor can add links at level 2.
    (+) Editor cannot add links at level 1.
    (+) Editor can edit and remove existing links at level 2.

    All tests pass.
    (+) If an editor edits a node with an existing level 1 link, they either see the fields as disabled in the node form (Drupal 10) or see a message indicating that they don't have access to edit the menu because of level (Drupal 11).
    (+) An editor can edit a node with an existing level 1 link and save without any impact to the existing menu item.

  • πŸ‡ΊπŸ‡ΈUnited States cameron prince

    On D11 with tugboat, all tests pass as well. MR looks good.
    Setting RTBC.

  • Pipeline finished with Skipped
    about 9 hours ago
    #573328
    • jastraat β†’ committed db502acf on 1.0.x
      Issue #3540845 by jastraat: Allow editors to see but not edit level-...
  • πŸ‡ΊπŸ‡ΈUnited States jastraat

    Thank you! Merged -

Production build 0.71.5 2024