- Issue created by @murz
- π¬π§United Kingdom SirClickALot Somerset
Agreed, but strictly only with an option in my opinion because often, we might others to clone our nodes that contain references to Paragraphs they they should not own copies of.
For example, in our educational site we have Chapters of learning.
Chapters of learning are broken up into Topics.
Topics are rigorously-vetted content reviewed by senior education specialists.A Teacher might wish to make a copy of a Programme and make a variation of their own and that's fine but if they choose to keep one or more Topics then there is no way that they should have ownership of that content because we cannot then vouch for its quality.
While I can see your requirement here, I also think it's beyond the scope of what this module aims to achieve which is merely to pre-fill a form with existing values, with the emphasis on the word values.
By contrast, you may find that the Replicate UI β module is what you are after because that one does exactly what you're asking for here and does so however deep the tree is.
- π¦π²Armenia murz Yerevan, Armenia
I agree that this should be optional and disabled by default.
But still, it is the case for the current module because other solutions like the suggested "Replicate UI" or "Entity Clone" - immediately create a copy, instead of pre-filling the entity form.
Seems, we still can pre-fill reference fields there too, if the form uses the "Inline Entity Form" widget type, to implement this feature.
Because with that "Paragraphs" module, we can fill manually the node form, add several paragraphs there, and they will be stored in the form state, without creating actual entities until we click "Create" and submit the full form.
Can we implement the same behavior by pre-filling referenced fields?
- π¦π²Armenia murz Yerevan, Armenia
And from the implementation point of view, seems we can create a new plugin, like the current "EntityLabelCloneSuffix", attached to only the "entity_reference" field type, that will do the thing.
- πΊπ¦Ukraine Tolyan4ik Lviv
Here is patch with Field processor to duplicate related entity.
- @tolyan4ik opened merge request.
- Status changed to Needs review
over 1 year ago 2:56pm 26 June 2023 - Status changed to RTBC
over 1 year ago 5:03am 27 June 2023 - π¦π²Armenia murz Yerevan, Armenia
I've tested the proposed fix and it works pretty stable! A couple of renamings and minor fixes from my side have been pushed, so let's move to Reviewed status.
- Status changed to Needs work
8 months ago 1:37am 15 April 2024 - π―π΅Japan orakili
This doesn't seem to work with some entity reference widgets like the media library or the inline entity form β module.
@Murz, would you be able to indicate with what widgets this plugin worked?
- πΊπΈUnited States chrisolof
I think the change in src/Plugin/FieldProcessorPluginBase.php is an unnecessary, breaking change that should be proposed in a separate issue. A change like that would normally go out in the next major version of a module so as not to break existing plugin implementations written against the 1.x plugin API.
- πΊπΈUnited States duckydan
For anyone that needs it, this already does this and has a really nice UI to manage how the entities are handled:
- πΊπΈUnited States chrisolof
MR 9 opened. Builds on MR 3.
- Uses the module's existing 1.x plugin definition API
- Condenses the code a bit
- Expands support to entity reference revisions fieldsNeeds review and testing. Using this along with MR 8 (from β¨ Add ability to clone a layout builder layout field Active ) allows me to deeply clone layout builder layouts, including sub-entities referenced from layout builder content blocks inside of layout components. Pretty neat.
Like in MR 8, it's possible we could use this module's clone process to clone these referenced entities when configured, falling back to the Drupal core-provided clone. That was not necessary for my project so I haven't gone that far here, but it certainly seems like a nice-to-have for projects that might need to configure how these referenced entities are cloned.
- πΊπΈUnited States chrisolof
The attached patch represents the state of MR 9 at the time of this comment.