- ๐ง๐ชBelgium weseze
Rerolled patch from #28 against latest release.
- last update
almost 2 years ago 3 pass - ๐บ๐ธUnited States xaqrox Washington, D.C.
Was using the previous patch on a project that included blocks with paragraphs, and we had a similar problem again: cloned blocks were referencing the same paragraphs as their source nodes. Editing paragraphs seemed to work since the actual field refers to revisions, but if you deleted one of the blocks the paragraph would be deleted as well. Here's a patch that includes cloning the paragraphs of the cloned blocks (and some slightly opinionated refactoring of the cloneParagraphs function).
- Issue was unassigned.
- ๐บ๐ธUnited States Webbeh Georgia, USA
Please include interdiffs when creating a new patch, or use the fork/MR functionality so folks can easily follow what changes have been made between contributions. Thanks!
- ๐บ๐ธUnited States xaqrox Washington, D.C.
My bad! Here's the interdiff.
- ๐บ๐ธUnited States nsciacca
Patch in #32 worked for me. I had Layout Builder blocks referencing paragraphs and found that cloned nodes that were unpublished were setting the source node's paragraphs to be unpublished - so anonymous visitors would see a blank page visiting the source node. This is working, thank you.
- ๐ณ๐ฑNetherlands seanB Netherlands
Just looked into this issue again. We might be able to remove the duplicate save with ๐ Cloned entities don't retain their Inline Block usage Needs work .
About cloning entities (nested), our lives would be a lot easier if we have ๐ It is not possible to react to an entity being duplicated Needs work .
To fix the (nested) cloning of paragraphs we have โจ Paragraph Library supports Entity Clone module Needs work . If we can make the paragraphs module support
hook_entity_duplicate_create()
, all the clone related modules would be a lot simpler.We could even have a core issue to make layout builder implement
hook_entity_duplicate_create()
, so the layout builder module is responsible for cloning all the blocks when an entity contains a layout builder field. - ๐บ๐ธUnited States xaqrox Washington, D.C.
#32 updated for 1.17/current 1.x
- Status changed to Needs work
about 1 year ago 11:33pm 18 January 2024 - ๐บ๐ธUnited States markdorison
Could we please convert this work to a merge request so that GitLabCI will run against it?
- First commit to issue fork.
- Status changed to Needs review
12 months ago 5:30pm 16 February 2024 - ๐จ๐ฆCanada phjou Vancouver ๐จ๐ฆ ๐ช๐บ
Not sure why the the patch doesn't apply for me:
https://git.drupalcode.org/project/quick_node_clone/-/merge_requests/22/... - ๐ง๐ชBelgium RandalV
@phjou Strange, if you use `.diff` instead, then it does work.
https://git.drupalcode.org/project/quick_node_clone/-/merge_requests/22/...Make sure to add an empty line at EOF, though.
- ๐ณ๐ฑNetherlands seanB Netherlands
Would it be possible to move
cloneParagraphs
,cloneInlineBlocks
to a separate service so it can be used in other code/modules? It would also be nice to move the code to clone a specific section to a separatecloneSection
method. I'm currently adding a custom controller that duplicates the code to clone a specific section in a layout, and it would be nice to reuse the code we have here. - ๐บ๐ธUnited States codechefmarc
Just FYI, I needed to update from 1.16 to 1.18 and the original patch we had didn't work for the new version. So, I removed the patch and decided to test this issue and it all seemed to work fine. Was this fixed from 1.16 to 1.18?
- ๐ณ๐ฑNetherlands seanB Netherlands
Added a commit to fix an issue while cloning layout builder content for the default language. It appears
InlineBlockEntityOperations::handlePreSave
does not run for syncing entities. - First commit to issue fork.
- ๐บ๐ฆUkraine Taran2L Lviv
taran2l โ changed the visibility of the branch 8.x-1.x to hidden.
- ๐บ๐ฆUkraine Taran2L Lviv
I've removed all refactoring to make everything a little bit easier to review and added a BC layer for the service constructor arguments change
- ๐ณ๐ฑNetherlands seanB Netherlands
The changes in
cloneParagraphs
are not entirely unrelated. For example,cloneParagraphs
only allowed cloning paragraphs in nodes, while inline blocks can also contain paragraphs. Can you revert your changes tocloneParagraphs
? - First commit to issue fork.
- ๐บ๐ธUnited States dblanken Carmel, Indiana
I made
cloneParagraph
's parametermixed
so that it won't bomb on things likeBlockContent
, which also calls that method. This still feels like a bandaid, but allows my sites to work. Are there other types we should be looking out for to be explicit and replace mixed? - ๐ณ๐ฑNetherlands seanB Netherlands
The parameter should probably be
FieldableEntityInterface
, I think we should just revert commit https://git.drupalcode.org/project/quick_node_clone/-/commit/4b2e8cbbb1f... - ๐บ๐ฆUkraine Taran2L Lviv
hi @dblanken @seanb
I've added FieldableEntityInterface back, the original change is doing a good refactoring, but it out of scope for this issue imo and makes it harder to understand and review (plus it's harder to combine patches)
- ๐บ๐ธUnited States dblanken Carmel, Indiana
Hi @taran2l
Thank you very much. I can confirm that with the FieldableEntityInterface it's working for us again. Thanks a lot for doing that.
- Assigned to Taran2L
- ๐ท๐บRussia kiseleva.t
kiseleva.t โ made their first commit to this issueโs fork.