- π³πΏNew Zealand ericgsmith
I took a closer look at this today, sharing my findings as I was a bit confused by the flow.
Following the steps to reproduce I wanted to see what was happening when I got to the step:
Create a draft of the "Test page" node by changing content and change menu link title to "Test page changed"
When the node form is submitted the
_menu_ui_node_save
function is called which updates the menu item.Specifically at https://git.drupalcode.org/project/drupal/-/blob/11.0.0-rc1/core/modules... it is setting the
isDefaultRevision
to match the$node
- in this case the$node
is a new draft revision and which is not the default and so the menu link content is set as not the default revision.However a new revision is
not
created for the menu link content - so when the entity storage handler saves the content it- leaves the original title in
menu_link_content_data
- saves the new title in
menu_link_content_field_revision
with the same revision id
I am not sure if this is expected but it seems very odd to have different data in the revision table and base table with the same revision id? I then found it had been previously mentioned in the related issue https://www.drupal.org/project/drupal/issues/3065180#comment-14052155 β
I briefly experiment with creating a new forward revision of the menu item when the node is saved as per that related issue - but that seemed to open up a whole new can on worms. The menu tree can't be reordered if there is a forward revision of any menu link content and there is no UI to view these.
Another other approach which I looked at was calling
_menu_ui_node_save
again with the default values as part of the moderation form submit. This works as it basically replicates what the menu ui is loading and saving if this was published via the node form itself - but it feels like a odd thing to be doing - but if the revision behaviour is expected then it could be simple change. - leaves the original title in
- π³πΏNew Zealand ericgsmith
Have pushed the code I was experimenting with - https://git.drupalcode.org/issue/drupal-3238156/-/compare/11.x...3238156...