Using node clone 7.x-1.0-rc2.
We have a custom content type that has entity references and we are using hook_node_clone_alter to grab the cloned node and clone the nodes that are referenced as well. Everything is working as expected, but the hook_node_clone_alter is getting called before and after the save: this is causing the referenced nodes to get duplicated.
- Click "clone"
- hook_node_clone_alter code is run and referenced nodes get cloned
- Land on "node/$nid/clone/confirm" and click save
- hook_node_clone_alter code is run and referenced nodes get cloned again
Settings:
Method to use when cloning a node: Pre-populate the node form fields
Confirmation mode when using the "Save as a new node then edit" method: Require confirmation (recommended)
Is this the expected behaviour?
I was looking for something in $context to tell me this is the second time through the hook so that I could skip the processing but there wasn't anything I could find (method=prepopulate both times through).
Comments
Comment #1
Dustin@PI CreditAttribution: Dustin@PI commented