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.

Command icon 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

chrisolof created an issue. See original summary.

chrisolof’s picture

Issue summary: View changes
Status: Active » Needs review

MR 12 fixes the TypeError I was running into when copying layout builder layouts with inline content blocks. Additionally, the changes in MR 12 should allow for layout cloning on sites with or without the Block Content module (and with or without inline Block Content blocks in their source layouts).

This is ready for review.