Add the parent entity to the widget state to fix base fields for Entity Browser

Created on 11 December 2021, almost 4 years ago
Updated 3 August 2023, about 2 years ago

Problem/Motivation

The Entity Browser module needs the parent entities bundle, in order to retrieve the third party settings with information about which Entity Browser to load.

This can be done easily for config fields, since the $widget_state added to the FormState by IEF holds information about the field instance. However when the field is a base field, there is no bundle information available, neither can it be easily accessed with the variables available.

See https://www.drupal.org/project/entity_browser/issues/2897622#comment-143... 🐛 IEF integration is broken for bundleless entities, base fields and unsaved form displays Needs work

Proposed resolution

My proposal is to add the 'parent' entity to the widget state, so we can easily access it to fetch the bundle.

Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

🇪🇸Spain nuez Madrid, Spain

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • I can confirm the comment in #4, this resolves the fatal error mentioned there in a case where I used the inline entity form complex formatter with an entity browser.

Production build 0.71.5 2024