localgov icon indicating copy to clipboard operation
localgov copied to clipboard

Add 'Entity Clone' or 'Replicate' to core

Open willguv opened this issue 1 year ago • 37 comments

We need to try installing https://www.drupal.org/project/replicate on LGD

(@markconroy has already got it working on Microsites in Essex and will push back to us)

willguv avatar Apr 02 '24 10:04 willguv

I'll try doing this with my new gitpod set up

willguv avatar Jun 06 '24 10:06 willguv

@willguv let's get a definition of what we want to do with replicate module. Installing it will do nothing, as it's just an API module. You need code then to use that API to achieve what we want.

I'm guessing we want to be able to clone all/some content types, and/or only certain users can use the clone functionality.

markconroy avatar Jun 07 '24 11:06 markconroy

Aha! I installed it and there was no visible change - that explains it

@dedavidson has done Replicate work for Dumfries. What did you do there please Duncan?

willguv avatar Jun 07 '24 11:06 willguv

If we get a list of what we want (or even some of what we want), I'll try spend time on this next week.

Maybe a generic approach with a settings form to say

  1. What content types should be replicatable?
  2. What user roles should be allowed to use replicate?

Then ... it would be up to each council to decide what way the want to use the module?

markconroy avatar Jun 07 '24 12:06 markconroy

@willguv try installing the replicate_ui module and that should give you access to click some options for what you want.

https://www.drupal.org/project/replicate_ui

markconroy avatar Jun 07 '24 12:06 markconroy

We used Entity Clone on D&G

dedavidson avatar Jun 07 '24 13:06 dedavidson

Was there a reason you picked Entity Clone over Replicate @dedavidson? Thanks

willguv avatar Jun 11 '24 09:06 willguv

@willguv nothing in particular except Replicate hasn't been updated in over a year and Entity Clone has more than double the sites using it.

dedavidson avatar Jun 11 '24 10:06 dedavidson

@dedavidson @markconroy I've just installed Entity Clone and think it might be a better bet

  • it largely works out of the box (just needs permissions to be set)
  • for the reasons Duncan mentioned about usage and updates

What do you think please?

I'm not a fan of the word "Clone" if I'm honest. We can discuss changing it if we go this route

willguv avatar Jun 11 '24 10:06 willguv

I've no problem with us using Entity Clone module.

markconroy avatar Jun 12 '24 10:06 markconroy

Thanks @markconroy let's go for it then!

Ideally Entity Clone should be added to core and enabled by default

Is there a way to change the word 'Clone' on the button to something else?

willguv avatar Jun 12 '24 10:06 willguv

We use replicate in microsites. Is there really a reason to have two modules that do the same thing in LGD? We also have had this discussion on an issue somewhere else I think? Ah! Here https://github.com/localgovdrupal/localgov_events/issues/96 The reason for replicate is that it can be controlled and configured by the developers to remove complexity, you can configure custom cloning (making sure the correct referenced entities are cloned etc.). Entity clone can't be used programatically. So one works both ways, the other not.

ekes avatar Jun 12 '24 10:06 ekes

OK that's interesting, thanks @ekes. We shouldn't have two modules doing the same thing

What do we need to use Replicate - a list of entities we would like it to be able to clone?

willguv avatar Jun 12 '24 11:06 willguv

I thought I posted on another issue, my question is what criteria would we prefer one over the other? Does paragraphs get cloned correctly with entity clone. Currently I'm building a replicate book feature for a BHCC section and possible expansion to publications with Replicate, is there an API to do that with entitiy clone as I wouldn't want to have duplicate modules.

andybroomfield avatar Jun 12 '24 15:06 andybroomfield

is there an API to do that with entitiy clone

No. It's UI, or specifically, form driven. Which is why we used replicate in Microsites. Where as with replicate, it is API first, but you can install, or build, a UI for it.

What do we need to use Replicate - a list of entities we would like it to be able to clone?

Yes, assuming the replicate UI module isn't up to the job... it's not something I've used.

What seems best is: Make a list of entities you want a 'clone' (or whatever) tab on; and decide by default which entity reference fields you also want duplicated, and which want to reference the existing entity. Generally I think this will be most 'text' paragraphs want duplicating, but stuff like media or geo want to reference the same entity. There might be other things for specific fields that help usability, like do you want to replicate the event into a form with the date empty?

ekes avatar Jun 17 '24 08:06 ekes

Andy: Issue with paragraphs and Entity Clone Ryan: Have to republish paragraphs with Entity Clone PaulB: Entity Clone issues with Subsites

willguv avatar Jun 26 '24 13:06 willguv

Finn: Write specific use cases

willguv avatar Jun 26 '24 13:06 willguv

BHCC has gone with Replicate and we've writen a module I could share to replicate whole books.

andybroomfield avatar Aug 12 '24 11:08 andybroomfield