Would it be possible to add an additional hook that contains the node id of the newly cloned node that other modules can subscribe to?

Comments

svendecabooter’s picture

Status: Active » Needs review
StatusFileSize
new588 bytes

I'd like to see this as well.
Attached is a simple patch that would accomplish this.

pwolanin’s picture

Looks simple enough - thogh I might make the name of the hook a little longer.

Also - I guess this will never run in the pre-populate case?

A better alternative might be to add some flag to the node that you could pick up when the normal node hooks run during node_save()

pwolanin’s picture

marking this other issue as duplicate #853776: Proposed Hook, and moving the patch here.

pwolanin’s picture

StatusFileSize
new834 bytes
pwolanin’s picture

Title: Add hook that contains the cloned node's id » Add a way to determinee that a node was a clone
pwolanin’s picture

StatusFileSize
new1.22 KB

probably no harm in adding this for both methods.

pwolanin’s picture

Status: Needs review » Fixed
StatusFileSize
new1.06 KB
new1.01 KB

5.x-2.x and 5.x-1.x patches

committed all to CVS.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

dww’s picture

Status: Closed (fixed) » Needs work

Sorry, but this doesn't do anything at all in the prepopulate case. The fact that you stuff something into $node isn't propagated at all through the whole node_form() mess such that by the time another module is in nodeapi('insert'), the handy clone_from_original_nid flag is gone. So, any functionality that's trying to tell if a node is being cloned (e.g. #1205304: Clone the panels display if using node_clone to clone a panelized node) only works if you configure node_clone to use the save-edit method.

For now, I just need to try to get this working, so I'll require save-edit, but it'd be really nice to get this working for real in both methods so that other modules can actually use this stuff.

Thanks,
-Derek

dww’s picture

Status: Needs work » Closed (fixed)

Nevermind, that bug now lives over at #939016: Use $node->clone_from_original_nid consistently. I'll reply there.

  • Commit 0dfdfd1 on 7.x-1.x, 8.x-1.x authored by dww, committed by pwolanin:
    Bug #939016 by svendecabooter, dww: Cloned node ID not set via...