/**
  * @inheritdoc
  */
 public function init()
 {
     // Определяем контейнер превью
     if ($this->preview) {
         $this->_defaultSingleSettings['elements']['preview'] = ['el' => '.uploader-preview', 'width' => 100, 'height' => 100];
     }
     // Определяем URL
     if ($this->url) {
         $fileName = $this->hasModel() ? $this->model->{$this->attribute} : $this->value;
         $this->url = $fileName ? rtrim($this->url, '/') . '/' . $fileName : null;
     }
     // Определяем ИД модели
     if ($this->modelId === null && $this->hasModel()) {
         $this->modelId = 'id';
     }
     // Отменяем авто-загрузку в случае использования кропа
     if ($this->crop) {
         $this->settings['autoUpload'] = false;
     }
     parent::init();
 }
Ejemplo n.º 2
0
            <span><?php 
echo FileAPI::t('fileapi', 'Add file');
?>
</span>
            <input type="file" name="<?php 
echo $fileVar;
?>
" />
        </div>
    </div>
    <div class="uploader-dnd"><?php 
echo FileAPI::t('fileapi', 'Drag and Drop');
?>
</div>
    <div class="uploader-dnd-not-supported"><?php 
echo FileAPI::t('fileapi', 'Browser does not support "Drag and Drop"');
?>
</div>
    <div class="uploader-files row">
        <div class="uploader-file-tpl col-sm-2">
            <div class="uploader-file">
                <div class="uploader-file-progress">
                    <div class="progress progress-striped">
                        <div class="uploader-file-progress-bar progress-bar progress-bar-info"
                             role="progressbar"
                             aria-valuenow="0"
                             aria-valuemin="0"
                             aria-valuemax="100"
                            ></div>
                    </div>
                </div>