Problem/Motivation
When using Inline Entity Form (IEF) to manage referenced entities such as Paragraphs, reusable blocks, or nested components inside Layout Builder manage display, editors often face the risk of unintentionally editing shared entities that are referenced in multiple places.
This happens because IEF edits the referenced entity directly, even if that entity is reused across layouts, nodes, or other entities. There’s no built-in way to “edit a copy” of the referenced entity.
This feature request proposes introducing a new option in the Inline Entity Form Complex widget:
“Edit as Clone”
to safely allow editing a duplicate when a referenced entity is shared.
Steps to reproduce
- Setup a default layout for the Program content type with a Cards block.
- The Cards block references a Card Item block.
- The Card Item title is “Title”.
- The Card title is “Cards”.
- Create Program A.
- Program A displays the default layout with the Cards block and Card Item.
- Edit the layout for Program A.
- Edit the Cards block.
- Update the Card title from “Cards” to “Cards A”.
- Update the Card Item title to “Title updated - Program A”.
- Save Program A.
- Create Program B.
- Program B displays the default layout showing “Cards”.
- However, Program B now displays the Card Item title as “Title updated - Program A”. (Incorrect)
- Edit Program B and update the Card title to “Cards B” and the Card Item title to “Title updated - Program B”.
- Revisit Program A →
- Card shows “Cards A” (Correct)
- Card Item shows “Title updated - Program B” (Incorrect)
Proposed resolution
We propose adding a widget configuration option — for example, a checkbox labeled:
“Edit referenced entities as clones”
When this option is enabled for a field using Inline Entity Form (Complex):
- The user-facing button will still be labeled Edit (no UI change for editors).
- However, when the editor clicks Edit, the module will:
- Detect if the referenced entity is used in multiple places (optionally using the Entity Usage module).
- If the entity is shared, automatically clone it (
$entity->createDuplicate()), save the clone, and replace the reference in the parent entity. - Open the edit form for the new cloned entity instead of the original.
- If the entity is used only once, edit it directly (no clone needed).
This approach maintains a simple editorial experience while allowing site builders to decide, per field, whether editing should always occur on a clone.
User interface changes
- New checkbox in field widget settings: “Allow users to edit as clone (if referenced elsewhere).”.
- No visible change in the frontend UI — the button remains labeled Edit.
Issue fork inline_entity_form-3557229
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