Add ability to clone a layout builder layout field

Created on 4 December 2024, 14 days ago

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.

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States chrisolof

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @chrisolof
  • πŸ‡ΊπŸ‡ΈUnited States chrisolof

    Merge 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.

  • πŸ‡ΊπŸ‡ΈUnited States chrisolof
Production build 0.71.5 2024