Problem/Motivation
My site's users would like the ability to clone pages with custom layouts crafted in Layout Builder. Unfortunately, the current "Copy values" field processor is not quite up to the task and results in cross-talk issues between the original and cloned layout.
Proposed resolution
Add a new field processor specifically for the 'layout_section' field type that can properly clone an entity's layout (without the cross-talk issues that come with a basic field value copy).
Remaining tasks
Patch + review.
User interface changes
New field processor option for Layout Builder layout fields.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | content_entity_clone-3491781-copy-layout-mr-8-2024-12-06.patch | 8.63 KB | chrisolof |
Issue fork content_entity_clone-3491781
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
chrisolofMerge request created. Working so far across a variety of complex layouts in my initial tests.
- New "Copy layout" field processor plugin, only offered for layout builder layout type fields.
- Clones each section inside of the layout
- Clones each component inside of each section, giving each component its own UUID. UUIDs are not intended to be shared.
- If component is a layout builder-provided content block, the content block is also cloned (at the revision specified by the component). These blocks are not intended to be shared across layouts. Cloning these blocks prevents cross-talk issues between original and cloned layouts. Block clone is done content_entity_clone-style if clone settings are enabled for the block type, falling back to a core entity clone.
- Copy values plugin adjusted to not show up for layout builder layout type fields, as it is inappropriate for that field type.
Needs review and additional testing.
Attached patch represents the current state of MR8 at the time of this comment.
Comment #4
chrisolofComment #5
orakili commentedTested with simple layouts and it seems to be working well. The code is clean. Thank you.
Comment #7
orakili commented