Skip to content

Commit

Permalink
Don't ignore AutoDiscover configuration - Fix perminder-klair#15
Browse files Browse the repository at this point in the history
  • Loading branch information
mrstroz committed Dec 10, 2018
1 parent 41e8145 commit adc1131
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion DropZone.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use yii\helpers\Html;
use yii\helpers\Json;
use kato\assets\DropZoneAsset;
use yii\web\View;

/**
* Usage: \kato\dropzonejs\DropZone::widget();
Expand Down Expand Up @@ -72,14 +73,16 @@ public function registerAssets()
{
$view = $this->getView();

$js = 'Dropzone.autoDiscover = ' . $this->autoDiscover . '; var ' . $this->id . ' = new Dropzone("div#' . $this->dropzoneContainer . '", ' . Json::encode($this->options) . ');';
$jsAutoDiscover = 'Dropzone.autoDiscover = ' . $this->autoDiscover;
$js = 'var ' . $this->id . ' = new Dropzone("div#' . $this->dropzoneContainer . '", ' . Json::encode($this->options) . ');';

if (!empty($this->clientEvents)) {
foreach ($this->clientEvents as $event => $handler) {
$js .= "$this->id.on('$event', $handler);";
}
}

$view->registerJs($jsAutoDiscover, View::POS_END);
$view->registerJs($js);
DropZoneAsset::register($view);
}
Expand Down

0 comments on commit adc1131

Please sign in to comment.