Skip to content

Commit

Permalink
Merge pull request #7 from JarrydGoodman/patches
Browse files Browse the repository at this point in the history
Added override for the default message.
  • Loading branch information
evgen-d committed Apr 22, 2015
2 parents 877d768 + bafa987 commit 861e23c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion DropZone.php
Expand Up @@ -21,6 +21,8 @@ class DropZone extends Widget
public $storedFiles = [];
public $sortable = false;
public $sortableOptions = [];
public $message;
public $messageOptions = [];

protected $dropzoneName = 'dropzone';

Expand All @@ -29,6 +31,7 @@ public function init()
parent::init();

Html::addCssClass($this->htmlOptions, 'dropzone');
Html::addCssClass($this->messageOptions, 'dz-message');
$this->dropzoneName = 'dropzone_' . $this->id;
}

Expand Down Expand Up @@ -92,9 +95,15 @@ public function run()
$options['params'][Yii::$app->request->csrfParam] = Yii::$app->request->getCsrfToken();
}

if (!empty($this->message)) {
$message = Html::tag('div', $this->message, $this->messageOptions);
} else {
$message = '';
}

$this->htmlOptions['id'] = $this->id;
$this->options = ArrayHelper::merge($this->options, $options);
echo Html::tag('div', '', $this->htmlOptions);
echo Html::tag('div', $message, $this->htmlOptions);

$this->registerAssets();

Expand Down

0 comments on commit 861e23c

Please sign in to comment.