Closed (fixed)
Project:
Entity Clone
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Nov 2018 at 10:07 UTC
Updated:
4 Jul 2023 at 08:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
NiCo_O commentedHere is the patch checking for EntityReferenceRevisionsFieldItemList rather then a fixed list of field type
Comment #3
mglamanThe check should be moved into fieldIsClonable.
Comment #4
NiCo_O commentedI thought about this, but this method is used only in one place, although it should also be used in
ContentEntityCloneFormBaseas well. Maybe we can movefieldIsClonableto a service or something more appropriate?Comment #5
mglamanTrue, but it makes it easier to override in child classes.
That would make sense for a service. That way you're not overriding _all_ instances of the clone and clone form classes. Just swapping the service.
Comment #6
NiCo_O commentedHere is another patch with a service to centralize the fieldIsClonable method so it can be used in both places
Comment #7
NiCo_O commentedComment #8
NiCo_O commentedComment #9
NiCo_O commentedComment #11
NiCo_O commentedComment #12
kevinfunk@NiCo_O 's patch from #8 is the main reason I switched from Replicate to Entity Clone. I've been using the patch for awhile without any issues.
Comment #13
colanPatch doesn't apply to HEAD cleanly.
Comment #14
katherinedPatch reroll.
Comment #16
alberto56 commentedThe patch in #14 no longer applies as of today's 8.x-1.0-beta6 version. (It applies to 8.x-1.0-beta5)
Comment #17
suresh prabhu parkala commentedRe-rolled patch of #14.
Comment #18
suresh prabhu parkala commentedSorry for that. The previous patch had PHPLint failures. Please review this updated patch.
Thank you.
Comment #19
rzb commentedRe-roll after fail.
Comment #21
rzb commentedRe-roll
Comment #22
rzb commentedThe patch was not taking in consideration the work done for the issue #3037470. Re-roll.
Comment #23
rzb commentedSorry, here is the good patch reroll.
Comment #25
8ballsteve commentedLooks like this needs another reroll against the latest 1.x branch - see attached
Comment #26
8ballsteve commentedHere's a patch that applies to 8.x-1.0-beta7
Comment #27
8ballsteve commented...and here's a patch that applied to 2.0.0-alpha1
Comment #28
jonathanshawThis looks like a good solution.
Comment #29
jonathanshawActually I have doubts about the implementation. This uses a generic service that applies to all entity types, but I doubt that the most common use case for customising this is to want to customise it for all entity types.
I'd imagine it's much more common to customise it for a specific entity type based on the specific fields of that entity type. In which case, it would be better if the clone form handler could call out to clone handler so customisation could be done there. A problem though is that fieldIsClonable is a protected method.
Solution:
1. Remove method
fieldIsClonablefromContentEntityCloneFormBase.2. Add an
isFieldClonablemethod toContentEntityCloneBaseand the relevant interface:3. In ContentEntityCloneFormBase call the clone handler:
Comment #30
alberto56 commentedI took @8ballsteve's patch at #27 and made a new version which works with 2.0.0-beta3.
Comment #32
ankitv18 commentedComment #33
ankitv18 commentedComment #34
ankitv18 commented@Rajeshreeputra please check below error as tests are not executing for this MR!46
No syntax errors detected in /var/www/html/modules/contrib/entity_clone/src/EntityClone/Content/ContentEntityCloneBase.php
No syntax errors detected in /var/www/html/modules/contrib/entity_clone/src/EntityCloneClonableField.php
--- Errors ---
PHP Parse error: syntax error, unexpected '*', expecting function (T_FUNCTION) or const (T_CONST) in /var/www/html/modules/contrib/entity_clone/src/EntityClone/Content/ContentEntityCloneFormBase.php on line 62
xargs: php: exited with status 255; aborting
Comment #35
vishalkhode commentedLooks like couple of changes needed:
src/EntityCloneClonableField.phphereuse Drupal\Core\Entity\ContentEntityStorageInterfacefrom Classsrc/EntityClone/Content/ContentEntityCloneFormBase.php.ContentEntityCloneFormBaseneed constructor of the class\Drupal\entity_clone\EntityCloneClonableField. We need to tweak it like:EntityCloneClonableFieldInterface:ContentEntityCloneFormBasefrom:To:
Comment #37
sakthi_dev commentedPlease review. Updated MR based on #35.
Comment #38
vishalkhode commentedNeeds work here, as there are PHP syntax error. The interface can't implement the method. The interface will only define the method and class with implement the method defined in the interface.
Comment #39
chandu7929 commentedComment #40
chandu7929 commentedWill check separatly for D10.1.x
Comment #41
vishalkhode commentedReviewed changes and looks good to me.
Comment #43
rajeshreeputramerged release to follow shortly. Wil release 2.0.0-beta4!