Problem/Motivation

The clone section contains a custom block with entity reference revision not working

Steps to reproduce

- Install the Section Library module.
- Create block type for example block-A.
- Create block type for example block-B.
- In block-B Add entity reference revision field to block-A.
- Make the field formatter an inline form complex
- Try adding block B with block-A items to the layout builder.
- Try to save the section from the section library.
- Try to import the template to another page.

Proposed resolution

  • Patch to fix the issue on inline blocks with entity reference revision

Remaining tasks

  • Patch fix
  • Core review
  • Test

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A
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

Qusai Taha created an issue. See original summary.

qusai taha’s picture

Assigned: qusai taha » Unassigned
Status: Active » Needs review
StatusFileSize
new7.16 KB

Patch to fix the issue on inline blocks with entity reference revision

rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes

qusai taha’s picture

StatusFileSize
new7.06 KB

Fix the issue after saving the layout builder page

rajab natshah’s picture

Title: Fix issue when clone section contain custom block with entity reference revision » Fix issue when cloned section contain custom block with entity reference revision
deepak.cms’s picture

$referenced_entities = $entity_field->referencedEntities();

Above line is giving an error when importing the section from library.

deepak.cms’s picture

StatusFileSize
new7.05 KB
jastraat’s picture

Version: 1.0.x-dev » 1.2.x-dev
Status: Needs review » Postponed (maintainer needs more info)

I was unable to recreate this error with an entity reference revision field targeting content block and using the steps above in 1.2.2. Are there additional steps required to trigger the error or more details that could be provided?

weseze’s picture

I think I ran into a similar issue over here: https://www.drupal.org/project/section_library/issues/3275063
Also had a blok reference field and expected the block reference to duplicate. Instead the section in the library was referencing the same block as the original section and the imported section was also referencing the same block.

Not sure if the suggested patch is the correct way of doing things.
Leaving entity references intact vs. duplicating the references feels like it should be a choice, not fixed behaviour.
That is why I suggested to have hooks available so you can decide to alter the behaviour in a custom setup.