# Summary

It clones nodes, including in VBO

# Project URL


# Where is the code?

#2194505: Port Node Clone to Drupal 8

# Estimated completion date


# Dependencies


# Who's doing the port?


# What help do they need?

There is a starting patch, but outdated

# D8 roadmap


# Background and reference information

#2194505: Port Node Clone to Drupal 8


pwolanin created an issue. See original summary.

Sam152’s picture

Issue summary: View changes

Do we want to deprecate this in favor of replicate_api and replicate_ui?

pwolanin’s picture

Not 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.

Sam152’s picture

Not 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.

pwolanin’s picture

That'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.

Kristen Pol’s picture

Issue summary: View changes
caseylau’s picture

When will this module of drupal8 be released? I need it to simplify my development!

pwolanin’s picture

I 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.

caseylau’s picture

the node_clone 8.x-1.x-dev version can't be use

pwolanin’s picture

Correct, it doesn't work yet. If you want to work on the code, please post a patch with your fixes to the actual issues.

giorgio79’s picture

I 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.

Sam152’s picture

I'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.

btopro’s picture

I 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)

Benia’s picture

Hi, is there a crude estimation when will the module be ready? Seems exactly like what I need for my D8 site :)

pwolanin’s picture

I 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.

miro_dietiker’s picture

I have been pointed recently to the entity clone module that is now available in d.o

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.

dasjo’s picture

geraldito’s picture

I use Quick Node Clone and it works ok.

colan’s picture

I'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.