Problem/Motivation
After an IEF form is cancelled or an item is removed the inline_entity_form storage is not cleared properly for that field.
If entity reference fields are used inside the edited entity then previously filled in entity reference fields will show inside the IEF entity, even though we are creating a new entity,
Steps to reproduce
- Standard Drupal installation
- Create an entity reference field with ief widget inside article that allows both basic pages and articles
- Create an article with an article inside with an article inside (root level + 2 levels deep)
- Cancel the first level IEF widget
- Create a new entity
- This new entity will reference the entity reference from the previously canceled article
The same behavior occurs when deleting the inline entity.
I've tested this with bundle selection.
Proposed resolution
On 'cancel' and 'delete' actions, the form state storage for that field and all underlying ief fields should be cleared.
Remaining tasks
Tests. Find out where this should be fixed.
User interface changes
API changes
Data model changes
Issue fork inline_entity_form-3421296
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
Comment #2
nuezComment #4
benstallings commentedHi, @nuez. I'm going to make another MR with a different approach: