38 lines
971 B
PHP
38 lines
971 B
PHP
<?php
|
|
|
|
namespace app\widgets;
|
|
|
|
use yii\base\Widget;
|
|
|
|
class FileWidget extends Widget
|
|
{
|
|
|
|
public $media_key;
|
|
public $object_key;
|
|
public $single_file = false;
|
|
public $media_type;
|
|
public $actions;
|
|
public $max_file_size = 3;
|
|
public $error_message = 'Too big file, (max 3mb)';
|
|
public $files;
|
|
public $resolutions = [];
|
|
public $model_class;
|
|
public $model_id;
|
|
|
|
public function run()
|
|
{
|
|
return $this->render("media/$this->media_type", [
|
|
'media_key' => $this->media_key,
|
|
'object_key' => $this->object_key,
|
|
'single_file' => $this->single_file,
|
|
'actions' => $this->actions,
|
|
'max_file_size' => $this->max_file_size,
|
|
'error_message' => $this->error_message,
|
|
'files' => $this->files,
|
|
'resolutions' => $this->resolutions,
|
|
'model_class' => $this->model_class,
|
|
'model_id' => $this->model_id
|
|
]);
|
|
}
|
|
}
|