- πΊπΈUnited States jastraat
Limiting this further - this is specifically a problem with paragraphs in inline blocks where the inline block was saved as part of a layout before creating a section template.
This is because the following code embeds the parent_id from the original inline_block and that parent_id is carried over to the clone as well as any further blocks created using the template.
$paragraph = \Drupal::entityTypeManager()->getStorage('paragraph')->load($value[$key]['target_id']); $new_paragraph = $paragraph->createDuplicate(); // It's important to save the entity in the IEF - complex case. $new_paragraph->save(); $new_value[$key]['target_id'] = $new_paragraph->id(); $new_value[$key]['target_revision_id'] = $new_paragraph->getRevisionId();
- πΊπΈUnited States jastraat
You can see that the entity_clone module was having a similar issue, and their fix was to NOT save the paragraph after creating a duplicate.
https://www.drupal.org/project/entity_clone/issues/3060223#comment-14327338 β - Merge request !40Issue #3293978: make cloned paragraphs independent of original inline block β (Merged) created by jastraat
- π«π·France Grimreaper France π«π·
Reproducing the bug.
I have not tested the fix yet.
I wonder if the problem also occurs more generally with any entity reference revision fields.
- π«π·France Grimreaper France π«π·
Hi,
Confirming that there is no problem with entity reference revisions field on node entity for example.
Fix with MR is ok with paragraphs.
-
jastraat β
committed f338ef84 on 1.2.x
Issue #3293978 by jastraat: Error after importing section/template that...
-
jastraat β
committed f338ef84 on 1.2.x
-
jastraat β
committed f338ef84 on 2.0.x
Issue #3293978 by jastraat: Error after importing section/template that...
-
jastraat β
committed f338ef84 on 2.0.x