Example #1
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     //init var
     if (empty($this->url)) {
         throw new InvalidConfigException('Url must be set');
     }
     if (empty($this->id)) {
         $this->id = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
     }
     $this->options['id'] = $this->id;
     if (empty($this->name)) {
         $this->name = $this->hasModel() ? Html::getInputName($this->model, $this->attribute) : $this->id;
     }
     //register Assets
     $assets = UploadifyAsset::register($this->view);
     $this->initOptions($assets);
     $this->initCsrfOption();
     parent::init();
 }
Example #2
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     //init var
     if (empty($this->url)) {
         $this->url = \yii\helpers\Url::to('index');
     }
     if (empty($this->id)) {
         $this->id = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
     }
     $this->options['id'] = $this->id;
     if (empty($this->name)) {
         $this->name = $this->hasModel() ? Html::getInputName($this->model, $this->attribute) : $this->id;
     }
     //register js css
     $assets = UploadifyAsset::register($this->view);
     //init options
     $this->initUploadifyOptions($assets);
     parent::init();
 }