Error "You can only change the parent menu link for the published version of this content"

Created on 13 May 2024, about 1 month ago
Updated 6 June 2024, 20 days ago

Problem/Motivation

Menu problems occur when editing page nodes with a langcode of 'und' (undefined) and using content moderation.

The error 'You can only change the parent menu link for the published version of this content' appears incorrectly when creating a draft of a published page that has a menu entry.

The problem occurs because a menu revision is created with the same langcode as the page node ('und'), whereas the rest of the menu structure has a langcode of 'en'. This means that joins fail when retrieving the menu information from the database and the 'parent' menu item is not set correctly when viewing the node edit form.

This happened in our databases because the page nodes were migrated from Drupal 7 (and langcode was set to 'und') whereas the menu structure was built in Drupal 10 (and has langcode of 'en').

Proposed resolution

Amend the code in _menu_ui_node_save so that the langcode of the menu entity is never changed to the langcode of the node. (We are only talking about editing existing menu entries here, so the langcode will always have been set correctly by the call to MenuLinkContent::load at the start of _menu_ui_node_save and it will never be necessary to change it.)

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Menu systemΒ  β†’

Last updated 2 days ago

Created by

πŸ‡¬πŸ‡§United Kingdom DuttonMa

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

Comments & Activities

Production build 0.69.0 2024