When I try to save using the MediaEntityDropzoneJsEbWidget, I get an error:

Undefined index: source_field in Drupal\dropzonejs_eb_widget\Plugin\EntityBrowser\Widget\MediaEntityDropzoneJsEbWidget->submit() (line 115 of modules/contrib/dropzonejs/modules/eb_widget/src/Plugin/EntityBrowser/Widget/MediaEntityDropzoneJsEbWidget.php

The code calling this is $bundle->getTypeConfiguration()['source_field']

I do not see source_field instantiated anywhere in the media_entity module, although the feature is referenced more generally in this issue #2625854: Provide default source_field when creating new media entity bundles.

As a workaround I manually edited my media_entity.bundle.image configuration YAML file, adding the source_field configuration, following the pattern in Media Pinkeye here.

Comments

jfrederick created an issue. See original summary.

jfrederick’s picture

I imagine this has to do with me not using the Media Entity Image module, which appears to set up the source_field for its included bundle.

primsi’s picture

Managed to fix that? My guess is that the media entity is not configured properly, as in missing the source_field mapping.

jfrederick’s picture

I fixed it for my own case with the manual YAML edit workaround I mentioned in #1.

I think maybe the source_field logic should be moved from the Media Entity Image module to the Media Entity module? For example, Media Entity Image module has Image::buildConfigurationForm(), which provides a UI to set the source_field. Users of Media Entity module do not have this.

phenaproxima’s picture

Status: Active » Closed (duplicate)