Unable to update micro-content entities via Inline Entity Form

Created on 13 October 2023, about 1 year ago
Updated 19 October 2023, about 1 year ago

Problem/Motivation

I am unable to update a micro-content entity via IEF on 2.0-rc9, downgrading to 1.0@RC fixes it.

The IEF was being used within a Layout Builder block, but i'm not sure that's relevant to the problem.

Steps to reproduce

  1. Start with a new drupal site and enable the ief, storage and dblog modules.
  2. 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.
  3. Create an instance of the content (without any storage entities)
  4. Edit that content and add storage entities
  5. Observe that when you click the "Update Component" button, the form doesn't submit an silently fails (doesn't report a problem)
  6. 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.

Attempt to update an existing micro-content entity via IEF, hit "Update micro-content", hit "Save" on the Layout, and then nothing changes. No errors are reported.

Sorry I don't have a lot of information on this, downgrading to 1.0@RC fixed the issue and I needed to continue on with the project. Figured I could at least report it.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States marcaddeo Rhode Island

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • 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.

    1. Start with a new drupal site and enable the ief, storage and dblog modules.
    2. 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.
    3. Create an instance of the content (without any storage entities)
    4. Edit that content and add storage entities
    5. Observe that when you click the "Update Component" button, the form doesn't submit an silently fails (doesn't report a problem)
    6. 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.

  • πŸ‡ΊπŸ‡ΈUnited States cosmicdreams Minneapolis/St. Paul
Production build 0.71.5 2024