[
'name' => 'videoFiles',
'title' => 'Видео: mp4, mov, avi',
- 'type' => FileInput::class,
+ 'type' => \kartik\file\FileInput::class,
'options' => [
+ 'multiple' => false,
+ 'accept' => 'video/*',
+ 'name' => 'video_name',
'style' => 'max-width: 150px; overflow: hidden;',
- 'options' => [
- 'multiple' => false,
- 'accept' => 'video/*',
- 'name' => 'video_name',
- ],
- 'pluginOptions' => [
- 'showPreview' => true,
- 'showCaption' => true,
- 'showRemove' => true,
- 'showUpload' => false,
- 'browseLabel' => '',
- 'removeLabel' => '',
- 'cancelLabel' => '',
- 'browseIcon' => '+',
- 'removeIcon' => '-',
- 'cancelIcon' => 'x',
- 'previewFileType' => 'video',
- 'allowedFileExtensions' => ['mp4', 'mov', 'avi'],
- 'initialPreview' => isset($model->id) ? [
+ ],
+ 'pluginOptions' => [
+ 'showPreview' => true,
+ 'showCaption' => true,
+ 'showRemove' => true,
+ 'showUpload' => false,
+ 'browseLabel' => '',
+ 'removeLabel' => '',
+ 'cancelLabel' => '',
+ 'browseIcon' => '+',
+ 'removeIcon' => '-',
+ 'cancelIcon' => 'x',
+ 'previewFileType' => 'video',
+ 'allowedFileExtensions' => ['mp4', 'mov', 'avi'],
+ 'initialPreview' => isset($model->id) ? [
+ Files::find()
+ ->select('url')
+ ->where([
+ 'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO,
+ 'entity_id' => $model->id
+ ])
+ ->scalar()
+ ] : [],
+ 'initialPreviewAsData' => true,
+ 'initialPreviewConfig' => isset($model->id) ? [[
+ 'type' => 'video',
+ 'caption' => basename(
Files::find()
->select('url')
->where([
'entity_id' => $model->id
])
->scalar()
- ] : [],
- 'initialPreviewAsData' => true,
- 'initialPreviewConfig' => isset($model->id) ? [[
- 'type' => 'video',
- 'caption' => basename(
- Files::find()
- ->select('url')
- ->where([
- 'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO,
- 'entity_id' => $model->id
- ])
- ->scalar()
- ),
- 'url' => Url::to(['delete-video', 'id' => $model->id]),
- ]] : [],
- ]
- ]
+ ),
+ 'url' => Url::to(['delete-video', 'id' => $model->id]),
+ ]] : [],
+ ],
+ 'columnOptions' => [
+ 'style' => 'max-width: 150px;'
+ ],
],
[
'name' => 'comment',