Implement hook_entity_duplicate for layout builder to duplicate inline blocks

Created on 27 May 2025, 28 days ago

Problem/Motivation

Now that we have 🐛 It is not possible to react to an entity being duplicated Needs work we should implement this hook for layout builder so inline blocks are automatically duplicated. This will also fix 🐛 Duplicating an entity with inline blocks does not duplicate the blocks Active in Drupal CMS once it is on 11.2.

Inline blocks must not be reused between 2 nodes because, by definition, they are only inline to a single entity. Having 2 entities reference the same inline block can break things in many ways, especially with new revisions being created and the inline block usage flow.

Steps to reproduce

Create entity with inline block in layout builder layout
Call createDuplicate() on it.

Proposed resolution

Implement hook_entity_duplicate in Layout Builder, recurse through sections and duplicate the block.

API changes

New hook_entity_duplicate implementation in LB.

📌 Task
Status

Active

Version

11.0 🔥

Component

layout_builder.module

Created by

🇦🇺Australia acbramley

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

Comments & Activities

Production build 0.71.5 2024