MenuLinkTree::load is sent a NULL for menu name but this not documented

Created on 24 August 2023, 10 months ago
Updated 28 August 2023, 10 months ago

Problem/Motivation

While working on πŸ› Restrict access to empty top level administration pages Fixed I discover that \Drupal\Core\Menu\MenuLinkTree::load is sometimes sent NULL for the menu name, like in \Drupal\system\Controller\SystemController::overview, but it is not documented that this possible and what it means. \Drupal\Core\Menu\MenuLinkTreeInterface::load says it must be a string and the function definition does not have parameter type hint.

This also cascades into the methods it calls passing on the NULL when it is also documented that is acceptable value into

  1. \Drupal\Core\Menu\MenuTreeStorage::loadTreeData

Proposed resolution

Update the @param doc to specify that NULL is possible value and in what circumstances.

If we could add a ?string type hint that would also be great

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
Menu systemΒ  β†’

Last updated less than a minute ago

Created by

πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

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

Comments & Activities

Production build 0.69.0 2024