ConfigEntityReference error during creation of the new referenced entity

Created on 8 June 2023, over 1 year ago
Updated 9 December 2023, about 1 year ago

Problem/Motivation

Inline Entity Form has the support of ConfigEntityReference. Current widget works properly with selecting of the existing config entity, but produce an error in case of creation of a new item.
The reason for that is that current class waits for FieldableEntityInterface class, but gets example of ConfigEntity (in my case it is menu entity).
TypeError: Drupal\inline_entity_form\ReferenceUpgrader::upgradeEntityReferences(): Argument #1 ($entity) must be of type Drupal\Core\Entity\FieldableEntityInterface, Drupal\system\Entity\Menu given, called in /var/www/docroot/modules/contrib/inline_entity_form/src/WidgetSubmit.php on line 57 in Drupal\inline_entity_form\ReferenceUpgrader->upgradeEntityReferences() (line 46 of /var/www/docroot/modules/contrib/inline_entity_form/src/ReferenceUpgrader.php)

Steps to reproduce

1. Create a config entity reference field.
2. Set inline entity form widget for the field.
3. Allow creation of a new reference item on the widget.
4. Try to create a new item and save the form.

Proposed resolution

Change code that saves reference. I'm not sure that it is enough to change only type of the variable. We also have to test carefully that ContentEntity reference is not broken.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Closed: outdated

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine anpolimus Kyiv

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

Comments & Activities

Production build 0.71.5 2024