/** * Registers required script for the plugin to work as jQuery File Uploader */ public function registerClientScript() { $view = $this->getView(); if ($this->plus) { FileUploadPlusAsset::register($view); } else { FileUploadAsset::register($view); } $options = Json::encode($this->clientOptions); $id = $this->options['id']; $js[] = ";jQuery('#{$id}').fileupload({$options});"; if (!empty($this->clientEvents)) { foreach ($this->clientEvents as $event => $handler) { $js[] = "jQuery('#{$id}').on('{$event}', {$handler});"; } } $view->registerJs(implode("\n", $js)); }
/** * Registers required script for the plugin to work as jQuery File Uploader */ public function registerClientScript() { $view = $this->getView(); $bundle = FileUploadAsset::register($view); if ($this->plus) { $bundle->js[] = 'blueimp-load-image/js/load-image.min.js'; $bundle->js[] = 'blueimp-canvas-to-blob/js/canvas-to-blob.min.js'; $bundle->js[] = 'blueimp-file-upload/js/jquery.iframe-transport.js'; $bundle->js[] = 'blueimp-file-upload/js/jquery.fileupload-process.js'; $bundle->js[] = 'blueimp-file-upload/js/jquery.fileupload-image.js'; $bundle->js[] = 'blueimp-file-upload/js/jquery.fileupload-audio.js'; $bundle->js[] = 'blueimp-file-upload/js/jquery.fileupload-video.js'; $bundle->js[] = 'blueimp-file-upload/js/jquery.fileupload-validate.js'; } $options = Json::encode($this->clientOptions); $id = $this->options['id']; $js[] = ";jQuery('#{$id}').fileupload({$options});"; if (!empty($this->clientEvents)) { foreach ($this->clientEvents as $event => $handler) { $js[] = "jQuery('#{$id}').on('{$event}', {$handler});"; } } $view->registerJs(implode("\n", $js)); }