/** * @inheritdoc */ public function init() { parent::init(); if (!isset($this->imagePreviewOptions['id'])) { $this->imagePreviewOptions['id'] = 'cropped-image-preview-' . $this->uid; } }
/** * @inheritdoc */ public function init() { parent::init(); if (array_intersect(['model', 'attribute', 'name'], array_keys($this->fileUploadButtonOptions))) { throw new Exception('You cannot use model, attribute, name keys in the upload button options '); } if (!isset($this->progressBarOptions['id'])) { $this->progressBarOptions['id'] = 'upload-file-progress-' . $this->uid; } if (!isset($this->fileUploadButtonOptions['name'])) { $this->fileUploadButtonOptions['name'] = 'select-file-button-' . $this->uid; } if (!isset($this->fileUploadButtonOptions['id'])) { $this->fileUploadButtonOptions['id'] = 'select-file-button-' . $this->uid; } if (!isset($this->uploadButtonOptions['name'])) { $this->uploadButtonOptions['name'] = 'Upload'; } if (!isset($this->uploadButtonOptions['class'])) { $this->uploadButtonOptions['class'] = 'btn btn-primary'; } if (!isset($this->uploadButtonOptions['title'])) { $this->uploadButtonOptions['title'] = 'Upload'; } $this->uploadButtonOptions['onclick'] = "{$this->javascriptVarName}.upload();"; if (!isset($this->clearButtonOptions['name'])) { $this->clearButtonOptions['name'] = 'Clear'; } if (!isset($this->clearButtonOptions['class'])) { $this->clearButtonOptions['class'] = 'btn btn-warning pull-right'; } if (!isset($this->clearButtonOptions['title'])) { $this->clearButtonOptions['title'] = 'Clear'; } $this->clearButtonOptions['onclick'] = "{$this->javascriptVarName}.clear();"; if (!isset($this->resetButtonOptions['name'])) { $this->resetButtonOptions['name'] = 'Restore'; } if (!isset($this->resetButtonOptions['class'])) { $this->resetButtonOptions['class'] = 'btn btn-default pull-right'; } if (!isset($this->resetButtonOptions['title'])) { $this->resetButtonOptions['title'] = 'Restore to Original'; } $this->resetButtonOptions['onclick'] = "{$this->javascriptVarName}.reset();"; }