- Issue created by @marcaddeo
- πΊπΈUnited States cosmicdreams Minneapolis/St. Paul
Hey there!
I also ran into this issue while setting up content to use a collection of Storage Entities. I spent some time debugging the problem and have some detail to report.
First, some testing steps.
- Start with a new drupal site and enable the ief, storage and dblog modules.
- Create a content type to have a field that references storage entities and use the inline entity form to allow one content edit page that is able to create both the node and the storage entities the node will use.
- Create an instance of the content (without any storage entities)
- Edit that content and add storage entities
- Observe that when you click the "Update Component" button, the form doesn't submit an silently fails (doesn't report a problem)
- Navigate to your database log and observe an error report that informs you that the site sent the StorageEntity into parts of core that expected the variable to be a NodeInterface not a Storage entity.
I haven't reviewed all of inline_entity_form to understand why it may be sending Storage Entities to Node processing, but I am suspicious of inline_entity_form_entity_type_build() in inline_entity_form.module line 39. Which is
This screenshot compares version 2 with 1 (2 is on the left). The reason why version 1 is working while 2 is not is likely because this conditionally logic was not in place. A Storage entity does not implement ContentEntityTypeInterface, only Nodes do (I think). Storage entities implement ContentEntityInterface though.
This discovery led to an existing patch in π TranslationHelper not working for EditorialContentEntityBase entities Active where the fix there was also to use conditional logic that checks if the incoming entity was a ContentEntityInterface instead of a ContentEntityTypeInterface.
What's the fix?
The true fix here? Likely better tests that checks if the thing being editing with inline entity form is something other than a node, maybe something that creates a custom entity and references it. Something that doesn't implement ContentEntityTypeInterface.