public function run() { $this->registerFile(); $this->registerUploadEvent(); $this->registerDeleteEvent(); $this->registerMainClientScript(); $view = $this->getView(); FileApiAsset::register($view); echo $this->render($this->viewFile, ['selector' => $this->getId(), 'fileVar' => 'file', 'input' => Html::activeHiddenInput($this->model, $this->attribute)]); }
public function run() { $this->registerFile(); $this->registerUploadEvent(); $this->registerDeleteEvent(); $this->registerMainClientScript(); $view = $this->getView(); FileApiAsset::register($view); if ($this->sortable) { SortableAsset::register($view); $view->registerJs("\n var el = \$('#" . $this->getId() . " .sortable')[0];\n var sortable = Sortable.create(el, " . Json::encode($this->sortableOptions) . ");"); } echo $this->render($this->viewFile, ['selector' => $this->getId(), 'fileVar' => 'file', 'input' => Html::hiddenInput(Html::getInputName($this->model, $this->attribute)), 'inputName' => $this->inputName()]); }