Problem/Motivation
In quick_node_clone.api.php we have this documentation:
function hook_cloned_node_alter(NodeInterface &$node, NodeInterface $original_node) {
$node->setTitle('Old node cloned');
$node->save();
}
So it mentioned to also save the node which will lead to create more than one clone and display this error:
The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.
Steps to reproduce
Create a hook with the displayed code and clone the node.
Proposed resolution
Update the documentation.
Also I think we can improve the documentation using more detailled example as we have in Quick node clone online documentation.
Finally a quick patch from #3307595: Improve API documentation #2 regarding passing object by reference hasn't been commited.
Remaining tasks
MR to submit.
Comments
Comment #3
tostinni commentedMR submitted
Comment #5
liam morlandThese changes look good to me.