Commit ef24d756 authored by Berdir's avatar Berdir Committed by Primsi

Issue #2952501 by marcoscano, Berdir, Primsi: EB widget should reset...

Issue #2952501 by marcoscano, Berdir, Primsi: EB widget should reset $source_field name after each event while saving
parent 7a307e58
......@@ -180,9 +180,9 @@ class MediaEntityDropzoneJsEbWidget extends DropzoneJsEbWidget {
public function submit(array &$element, array &$form, FormStateInterface $form_state) {
/** @var \Drupal\media\MediaInterface[] $media_entities */
$media_entities = $this->prepareEntities($form, $form_state);
$source_field = $this->getType()->getSource()->getConfiguration()['source_field'];
foreach ($media_entities as &$media_entity) {
$source_field = $this->getType()->getSource()->getConfiguration()['source_field'];
$file = $media_entity->$source_field->entity;
/** @var \Drupal\dropzonejs\Events\DropzoneMediaEntityCreateEvent $event */
$event = $this->eventDispatcher->dispatch(Events::MEDIA_ENTITY_CREATE, new DropzoneMediaEntityCreateEvent($media_entity, $file, $form, $form_state, $element));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment