- Issue created by @cxc891
- πΊπΈUnited States cxc891
Fixed it by lowering the module weight so it runs before the token module.
- π―π΅Japan ultrabob Japan
We could update the install hook and add an update hook to set the module weight to be lower than the token module's if it is installed, but it would be better to figure out the cause. I couldn't immediately identify what would be happening as a result of submitting via workflow buttons as opposed to selecting the target state and saving.
I'm running out of time to look at this today, but it seems like the next step is identifying what is happening on a workflow_buttons submission that would undo the work that token does on save.That is just in case it gives somebody else a jumping-off point for trying to identify the culprit.
@cxc891 did you identify something in particular that lead you to the module weight solution?
- πΊπΈUnited States cxc891
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 theMenuLinkContent::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...
- π―π΅Japan ultrabob Japan
workflow_buttons_preprocess_node in workflow_buttons.module is where isDefaultRevision gets set. There is another issue for removing that preprocess π Remove unused preprocess Needs work . It would be interesting to know if removing that preprocess hook would fix this issue.
- πΊπΈUnited States cxc891
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 theformElement
or theprocessActions
function, whichever is responsible for loading and passing the entity to downstream modules. - πΊπΈUnited States cxc891
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.
- π―π΅Japan ultrabob Japan
@cxc891. Do you have anything to report back on this?
- πΊπΈUnited States cxc891
@ultrabob, yes. However, deleting the whole preprocess section does not change anything, nor does the code in #8.