I can confirm that adding WorkflowButtonsWidget::validateElement
fixes my issue. I tested it after setting the module weight back to default (0) and everything is working as expected.
@ultrabob, yes. However, deleting the whole preprocess section does not change anything, nor does the code in #8.
I think we need to borrow a line from the content_moderation core module, inside the formElement
function there is this line to load the most recent revision
$original_entity = $this->entityTypeManager->getStorage($entity->getEntityTypeId())->loadRevision($entity->getLoadedRevisionId());
I will test and report.
Hmm, I thought the preprocess was just to make extra variables avail to the templates. Anyway, the issue is not gone when the function is commented out.
I'm now thinking if it's something inside the WorkflowButtonsWideget
class. Either the formElement
or the processActions
function, whichever is responsible for loading and passing the entity to downstream modules.
Thanks for looking into it @ultrabob
I started to believe it might be the weight when I set a breakpoint inside the function "token_node_menu_link_submit" in token.module file. The $node object has something strange going on. $node['#values']['isDefaultRevision']=>["x-default"=>"1"]
however, the "isDefaultRevision()"
method returns false.
Inside the same function, a MenuLinkContent entity is created using data from $node. And there is $entity->isDefaultRevision($node->isDefaultRevision());
before the entity is saved. This takes the "false" value from above and assigns it to the entity, which leads to the MenuLinkContent::postSave
not updating the menu tree.
The same issue was causing me a WSOD if I edit a node that's never in a menu and assign it a menu parent. I got something like a "menu plugin not found" error message. Makes sense given my investigation above.
I checked the code from this module too but couldn't find anything that might be a culprit...
Fixed it by lowering the module weight so it runs before the token module.
cxc891 β created an issue.