[
'name' => 'videoFiles',
'title' => 'Видео: mp4, mov, avi',
- 'type' => FileInput::className(),
+ 'type' => FileInput::class,
'value' => function ($row) {
if (!isset($row['id'])) return null;
$file = Files::findOne([
'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO,
- 'entity_id' => $row['id']
+ 'entity_id' => $row['id'],
]);
return $file ? $file->url : null;
if (isset($rowModel['id'])) {
$file = Files::findOne([
'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO,
- 'entity_id' => $rowModel['id']
+ 'entity_id' => $rowModel['id'],
]);
if ($file) {
'type' => 'video',
'caption' => basename($file->url),
'url' => \yii\helpers\Url::to(['delete-video', 'id' => $rowModel['id']]),
+ // Убрал confirm и метод, можно добавить при необходимости
]];
}
}
return [
+ 'options' => [
+ 'style' => 'width: 250px; white-space: normal;', // уменьшаем ширину колонки
+ ],
+ 'attribute' => 'videoFiles',
'options' => [
'multiple' => false,
'accept' => 'video/*',
- 'name' => 'video_name'
+ 'name' => 'video_name',
+ 'class' => 'file', // как у фото
],
'pluginOptions' => [
'showPreview' => true,
'showCaption' => true,
'showRemove' => true,
- 'showUpload' => true,
+ 'showUpload' => false, // как у фото — не показываем кнопку загрузки
+ 'browseClass' => 'btn btn-primary btn-sm', // кнопка как у фото (синий маленький btn)
+ 'browseIcon' => '<i class="glyphicon glyphicon-plus"></i>',
+ 'browseLabel' => 'Выбрать видео',
'previewFileType' => 'video',
- 'allowedFileTypes' => ['video'],
'allowedFileExtensions' => ['mp4', 'mov', 'avi'],
'maxFileSize' => 10240,
'initialPreview' => $initialPreview,
'initialPreviewAsData' => true,
'initialPreviewConfig' => $initialPreviewConfig,
+ 'fileActionSettings' => [
+ 'showUpload' => false, // не показываем кнопку загрузки возле файла
+ 'showZoom' => true,
+ 'showRemove' => true,
+ ],
],
];
},
],
-
[
'name' => 'comment',
'type' => 'textInput',