Closed (won't fix)
Project:
Node clone
Version:
6.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 Nov 2009 at 20:18 UTC
Updated:
25 Oct 2015 at 14:17 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
pwolanin commentedNo, I don't understand.
Please provide a proof-of-concept patch at least.
Comment #2
pwolanin commentedComment #3
kars-t commentedI mean cascading cloning.
A has a node reference to B.
If I use node clone to make a clone of A the new C will point to B as well.
A->B to C-->B
C is a clone of A
B remains
What I want is that if I clone A there will be a C that points to a new D which is a clone of B.
A->B to C->D
C is a clone of A
D is a clone of B
We are currently writing such a thing for a customer and maybe I can show a patch later on. There are some problems with the possibility of endless loops so maybe all node IDs should be cached and not cloned more than once. Or you could set a depth by a GUI. For this particular case it will work but for a patch we need something more common.
Right now I just wanted to check if this feature is already available. So it is just a feature request :)
Comment #4
pavel.karoukin commentedI bet you already solved this issue, but in case you still interested in solution - here is module committed by me today - http://drupal.org/project/node_clone_reference
Basically, you can select which fields you want to clone and which - not to clone.
Comment #5
BIGREDPAUL commentedHi was just wondering how you are going to code_clone_reference.
I need a way to link cloned nodes back to thier originals.
I ask because the link above is restricted.
Comment #6
finex commentedHi! The module linked on comment#4 is not accessibile... has it been renamed?
Comment #7
socialnicheguru commentedIs the project available?
Comment #8
socialnicheguru commentedI did a search on google and saw this. Has anyone tried it?
http://www.webindustries.co.nz/clone-node-reference-module
Comment #9
stevef commentedHi, in regards to #8 - we had this module developed for us. As the developer was not available to maintain the module it has not been committed. If anyone wants to review, contribute and maintain - please let me know.
I can confirm that it is used extensively on a production site, and has been thoroughly tested. The module creates a set of Admin GUI options allowing you to specify Node Reference fields that need to be re-created in the newly created cloned Node.
It also optionally allows you to convert Nodes from Content Type 'A' to Content Type 'B' during the cloning process, and, convert the relevant Node Reference fields to remain consistent with the Node conversion process. So:
1. we have Content Type 'Goal Template' nodes to which we have referenced multiple 'Action Templates' nodes
2. on cloning, we clone the Node Reference field contained in the 'Goal Template'
3. we convert the 'Goal Template' to a 'Goal' and the 'Action Templates' to 'Actions' (this conversion is so we can set Permissions differently for the various CTs)
4. we are required to use a different Node Reference field in the newly created nodes of different CT, and so we also convert the 'field_goaltemplate_actionsref' to 'field_goal_actionsref'
Not sure if that last bit makes things clearer - but am happy to answer any questions. This module allows you to set the options required for steps 2-4 to occur.
Cheers,
Steve
Steve Flowers
www.webindustries.co.nz || www.hiredguns.co.nz
Comment #10
kevin.mcnamee@mailbox.org commentedsubscribing
Comment #11
kevin.mcnamee@mailbox.org commentedHi,
I have patched the Node Clone module to get this working. The solution is very clean and hopefully Drupalish. By enabling Node Clone to invoke events, the Rules module can be used to handle the logic and allow the user to do whatever changes need to be done to the cloned node.
The Event is called "Content has been cloned" and provides both the original node, the cloned node and acting user as input to a Rule. The rule can then be configured to use a Views Bulk Operation (VBO) to clone child nodes and update any node references the developer has. For example, the following code can be used to with the "Execute arbitrary PHP script" VBO action to update node references:
By leveraging Rules, the "Content has been cloned" event can be used to trigger messages, watchdog, etc.
A diff is attached which also includes a new clone.rules.inc file. As a bonus, the diff also creates an Action called "Clone node" which could be useful for other things. There is no dependency created on the Rules module. If Rules exists then the Event will be made available to it.
Cloning nodes automatically will produce nodes with "Clone of " in the title. I found the Automatic Nodetitles useful for generating more meaningful titles.
Comment #12
pwolanin commentedInteresting idea. I think the patch may be missing a trigger in the pre-populate case? Or is it not possible to handle that?
Comment #13
kevin.mcnamee@mailbox.org commentedThe prepopulate case is handled by the clone_nodeapi hook. By passing along the "clone_from_original_nid" variable, the cloned Event can be invoked on "insert".
The prepopulate case is the one that I am using on my site and it works perfectly.
/Kevin
Comment #14
socialnicheguru commentedI have a workplan which has several projects and each project has several tasks. Node reference is used to link them together
I would like to just copy the workplan and then have each project copied and then each task copied and all the nod references updated. Is there a way to do this using the patch above?
PS. Since node clone 6.x-1.3 there is no need to add this code as it is part of clone.module file now
Comment #15
kevin.mcnamee@mailbox.org commentedYes, it is possible to do cascade clones of depth 1, 2 or more. The patch is generic, triggering a "Content clone" event that Rules can act on. You will have to set up at least one generic VBO and Rule, or perhaps one VBO + Rule for each node type: workplan, project and task depending on your needs.
/Kevin
Comment #16
stomerfull commentedHello every body
I really need this module for my site
I have installed the module in this site http://www.webindustries.co.nz/clone-node-reference-module
But i' m not able to get it working
Can you describe how to setting up the module in the admin interface of clone module?
Thank you very much for your help
Comment #17
stomerfull commentedI have a nodereference setting like in the image join in my content type
and when i duplicate node, these nodereference is not duplicate (clone)
and i'm using Clone module 6.x-1.3
thank you
Comment #18
stomerfull commentedany idea?
Comment #19
stomerfull commentedOk,
I made some changes in
of clone_noderef.module and it works like charm
:-)
Now i'm able to duplicate nodereference inside node
But basically it doesnt work because i don't use a nodereferer field
Thank you
Comment #20
socialnicheguru commentedIs there anyway to achieve this in Drupal 7?
Comment #21
stomerfull commentedIn D7, i havent yet testing it but i think it is the same principe
Comment #22
kevin.mcnamee@mailbox.org commentedHi,
I have rerolled the patch in #11.
/Kevin
Comment #23
technikh commented+1 for D7
Comment #24
pwolanin commentedI did add a feature like this to D7. Not adding new features to D6 now.