TypeError in CopyLayout field processor when copying a layout builder layout

Created on 18 March 2025, 18 days ago

Problem/Motivation

Attempting to clone an entity's layout containing inline content blocks fails with a TypeError:

TypeError: Drupal\content_entity_clone\Plugin\content_entity_clone\FieldProcessor\CopyLayout::cloneBlockContentEntity(): Argument #1 ($original) must be of type Drupal\content_entity_clone\Plugin\content_entity_clone\FieldProcessor\BlockContentInterface, Drupal\block_content\Entity\BlockContent given, called in web/modules/contrib/content_entity_clone/src/Plugin/content_entity_clone/FieldProcessor/CopyLayout.php on line 135 in Drupal\content_entity_clone\Plugin\content_entity_clone\FieldProcessor\CopyLayout->cloneBlockContentEntity() (line 166 of web/modules/contrib/content_entity_clone/src/Plugin/content_entity_clone/FieldProcessor/CopyLayout.php).

It appears 7503032c was added after MR8 was merged, allowing the processor to load in sites where the Block Content module is not enabled (but not function - see 110). Unfortunately, the changes in this commit render the copy_layout field processor non-functional when cloning layouts with inline content blocks (which is a common use case in my site).

Steps to reproduce

Create an entity with a layout builder layout that contains one or more inline content blocks. Attempt to clone this entity's layout and see the failure.

Proposed resolution

Resolve the remaining issues required to allow this copy_layout processor to load and copy layouts on sites with or without the Block Content module (and with or without inline Block Content blocks in the source layout).

Remaining tasks

- MR
- Review

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
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

Production build 0.71.5 2024