-
Notifications
You must be signed in to change notification settings - Fork 1
/
Widget.php
52 lines (46 loc) · 1022 Bytes
/
Widget.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* Widget
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 22.10.2014
* @since 1.0.0
*/
namespace skeeks\widget\simpleajaxuploader;
use skeeks\widget\simpleajaxuploader\Asset;
use yii\helpers\Json;
use yii\base\Widget as BaseWidget;
/**
* For example:
*
* <?php
* namespace bla\bla;
* use skeeks\widget\simpleajaxuploader\Widget;
* echo Widget::widget({
* "clientOptions" =>
* [
* "name" => ""
* ]
* });
* ```
*
* @author HimikLab
* @see http://www.jacklmoore.com/colorbox/
* @package himiklab\colorbox
*/
class Widget extends BaseWidget
{
/** @var array $targets */
public $clientOptions = [];
public function init()
{
parent::init();
$view = $this->getView();
$options = Json::encode($this->clientOptions);
$script = "new ss.SimpleUpload($options);" . PHP_EOL;
$view->registerJs($script);
Asset::register($view);
}
}