Orphaned menu items should support removeDefinition

Created on 28 January 2017, over 8 years ago
Updated 9 September 2025, 8 days ago

Steps to reproduce

  1. Install a clean Drupal 8 with the Standard installation profile
  2. Go to admin/structure/menu/manage/main and disable the Home menu item. This will write the menu item to core.menu.static_menu_link_overrides.
  3. Delete file core/profiles/standard/standard.links.menu.yml
  4. Clear cache
  5. Try to delete the orphaned menu item:
    $home_manager = \Drupal::service('plugin.manager.menu.link');
    $home_manager->removeDefinition('standard.front_page');
    

Expected behavior

We are able to delete the menu item.

Actual behavior

We get the following error:

Uncaught PHP Exception Drupal\Component\Plugin\Exception\PluginException: "Menu link plugin with ID 'standard.front_page' does not support deletion".

Also, trying to reset the menu item at admin/structure/menu/link/standard.front_page/reset results in a fatal error:

Recoverable fatal error: Argument 1 passed to Drupal\Core\Menu\MenuTreeStorage::save() must be of the type array, null given, called in /Users/wim.mostrey/Sites/drupal82/core/lib/Drupal/Core/Menu/MenuLinkManager.php on line 406 and defined in /Users/wim.mostrey/Sites/drupal82/core/lib/Drupal/Core/Menu/MenuTreeStorage.php on line 257

We are now stuck with a menu item that can not be deleted nor reset.

πŸ› Bug report
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

menu system

Created by

πŸ‡§πŸ‡ͺBelgium wmostrey

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for reporting this problem. We rely on issue reports like this one to resolve bugs and improve Drupal core.

    Since there has been no activity here for over 8 years we are asking if this problem persists on a currently supported version of Drupal. To help, add a comment explaining if the problem still occurs or not. Any extra detail you can provide can help others who experienced this.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
    Thanks!

Production build 0.71.5 2024