Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
# Summary
It clones nodes, including in VBO
# Project URL
https://www.drupal.org/project/node_clone
# Where is the code?
#2194505: Port Node Clone to Drupal 8
# Estimated completion date
TBD
# Dependencies
none
# Who's doing the port?
Sutharsan?
# What help do they need?
There is a starting patch, but outdated
# D8 roadmap
TBD
Comments
Comment #2
Sam152 CreditAttribution: Sam152 commentedDo we want to deprecate this in favor of replicate_api and replicate_ui?
Comment #3
pwolanin CreditAttribution: pwolanin as a volunteer commentedNot sure - it sounds like that's a much more complex module.
Node clone has always focused on being as simple as possible and handling just the node content use case.
Comment #4
Sam152 CreditAttribution: Sam152 commentedNot sure why we should be supporting modules that just handle the node use case. Moving towards more generic entity-centric modules is generally more useful in my opinion.
The replicate API itself is very simple, 200 odd lines of code (http://cgit.drupalcode.org/replicate/tree/replicate.module) which simply provide the foundation for making copies of entities. It's pluggable so that developers can have fine grained control over the replication as well as install any complementary modules which can clone associated entities (like field collection items, commerce products and terms).
I don't really mind where this functionality lives, but if the solution is generic node_* is probably a poor choice.
Comment #5
pwolanin CreditAttribution: pwolanin as a volunteer commentedThat's just a 7.x module - so it also needs to be ported to 8?
A lot of the code in node_close is around things like pre-populating form values. It doesn't looks like replicate_ui supports that at all? It also looks like the 7.x version at least still has a lot of node-specific code?
Side note, the hook_help code in replicate,module is a flawed use of the API since the output of that check_markup() depends on the default text format selected for the site.
Comment #6
Kristen PolComment #7
lawxen CreditAttribution: lawxen commentedWhen will this module of drupal8 be released? I need it to simplify my development!
Comment #8
pwolanin CreditAttribution: pwolanin as a volunteer commentedI made a 7.x-1.0 release (finally), so now is a good time to start.
I just renamed the file and function, and ran drupalmoduleupgrader over it.
Feel free to take the 8.x-1.x branch and start trying to make it work.
Comment #9
lawxen CreditAttribution: lawxen commentedthe node_clone 8.x-1.x-dev version can't be use
Comment #10
pwolanin CreditAttribution: pwolanin as a volunteer commentedCorrect, it doesn't work yet. If you want to work on the code, please post a patch with your fixes to the actual issues.
Comment #11
giorgio79 CreditAttribution: giorgio79 commentedI am also a fan of replicate and node clone. Used node clone until I needed to clone entities as well, hence switched to replicate. Perhaps, the different modes of cloning (eg prepopulate, vs copy a new version in the backend and allow the user to edit it) could become a config option in a merged module.
Comment #12
Sam152 CreditAttribution: Sam152 commentedI'd almost imagine replicate was a dependency of node clone. The prepopulate functionality could be as easy as a replicated node with unpublished set. But this could also just as easily fit into replicate_ui which also moves away from the "nodes are a special entity" attitude.
Comment #13
btopro CreditAttribution: btopro commentedI could see replicate being in core as it's basically extending the operations of entity api. it's very small because it has a dedicated but incredibly useful purpose; have a copy of an object but with the primary keys wiped.
Replicate UI (i wrote it) provides menu paths, actions, and views plugins to allow for utilizing this API from the front-end. See a user/node/field_collection/etc, want to replicate it, click the replicate tab, confirm and you are taken to the view of the newly replicated item.
Node clone is more for prepopulation and is specific to the node entity type where-as replicate works with any entity type as it's much smaller in scope. I could see node_clone using replicate but node_clone doesn't actually produce items it just sets forms in motion as more of a "make one like this" kind of an option. The universe of replicate_ sub modules in contrib all focus around very small modifications to different entity types at the time of replication in order for them to have certain properties wiped. Those include the following (all of which are small in scope)
Comment #14
Benia CreditAttribution: Benia commentedHi, is there a crude estimation when will the module be ready? Seems exactly like what I need for my D8 site :)
Comment #15
pwolanin CreditAttribution: pwolanin as a volunteer commentedI have been blocked on this core bug for a full port: #2624594: Local action plugins do not have any way to provide cacheability metadata I might do a small partial port waiting for that to go in.
@btopro - for D6 and D7 the module can either pre-populate OR save and then edit, plus there is an action so you can use VBO to clone, and also a set of hooks.
Since nodes are still a bit one-off, I'm not sure it makes sense to make it generic.
Comment #16
miro_dietikerI have been pointed recently to the entity clone module that is now available in d.o
https://www.drupal.org/project/entity_clone
Not sure if node clone contains some more functionality, but i also think we should make a module with generic entity support a successor of node_clone and avoid duplicate work.
Comment #17
dasjoalso see https://github.com/AmazeeLabs/node_duplicate
Comment #18
geraldito CreditAttribution: geraldito as a volunteer commentedI use Quick Node Clone and it works ok.
Comment #19
colanI've been working on Entity Clone, which I think is the best way forward (at least in the long-term). We could really use some help with #2706639: Support for sub-entity cloning, which is currently holding up a release.
Comment #20
jwilson3@pwolanin: Would it be possible to add a reference to Entity_Clone as the replacement on the Node Clone project page, then close this issue?
Comment #21
colanThe new "Replaced by" project field would be useful here. :)
Comment #22
colanSorry, double post; text removed.