diff --git a/modules/eb_widget/js/dropzonejs_eb_widget.common.js b/modules/eb_widget/js/dropzonejs_eb_widget.common.js index 542c70d..6d88d7d 100644 --- a/modules/eb_widget/js/dropzonejs_eb_widget.common.js +++ b/modules/eb_widget/js/dropzonejs_eb_widget.common.js @@ -36,7 +36,7 @@ } }); - if (drupalSettings.dropzonejs.auto_select) { + if (drupalSettings.entity_browser_widget.auto_select) { item.instance.on("queuecomplete", function () { var dzInstance = item.instance; var filesInQueue = dzInstance.getQueuedFiles(); diff --git a/modules/eb_widget/src/Plugin/EntityBrowser/Widget/DropzoneJsEbWidget.php b/modules/eb_widget/src/Plugin/EntityBrowser/Widget/DropzoneJsEbWidget.php index 817bc93..addc431 100644 --- a/modules/eb_widget/src/Plugin/EntityBrowser/Widget/DropzoneJsEbWidget.php +++ b/modules/eb_widget/src/Plugin/EntityBrowser/Widget/DropzoneJsEbWidget.php @@ -135,7 +135,7 @@ public function getForm(array &$original_form, FormStateInterface $form_state, a $original_form['#attributes']['class'][] = 'dropzonejs-disable-submit'; // Add hidden element used to make execution of auto-select of form. - if ($this->configuration['auto_select']) { + if ($config['settings']['auto_select']) { $form['auto_select_handler'] = [ '#type' => 'hidden', '#name' => 'auto_select_handler', @@ -151,8 +151,6 @@ public function getForm(array &$original_form, FormStateInterface $form_state, a ], ], ]; - - $form['#attached']['drupalSettings']['dropzonejs']['auto_select'] = $this->configuration['auto_select']; } return $form; @@ -261,7 +259,9 @@ public function submit(array &$element, array &$form, FormStateInterface $form_s */ protected function selectEntities(array $entities, FormStateInterface $form_state) { if (!empty(array_filter($entities))) { - if ($this->configuration['auto_select']) { + $config = $this->getConfiguration(); + + if ($config['settings']['auto_select']) { $form_state->set('added_entities', $entities); } else { @@ -419,7 +419,7 @@ public static function handleAjaxCommand(array $form, FormStateInterface $form_s // Add Invoke command to select uploaded entities. $ajax->addCommand( new InvokeCommand('.entities-list', 'trigger', [ - 'load-entities', + 'add-entities', [$entity_ids], ]) );