Skip to content
This repository has been archived by the owner on Jan 5, 2018. It is now read-only.

Commit

Permalink
Adjusted code to correspond to entity browser changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mtodor committed Nov 6, 2016
1 parent ee5cf3e commit 1094a7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion modules/eb_widget/js/dropzonejs_eb_widget.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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],
])
);
Expand Down

0 comments on commit 1094a7a

Please sign in to comment.