// 'style' => 'width: 70px;',
]
],
-[
- 'name' => 'videoFiles',
- 'title' => 'Видео: mp4, mov, avi',
- 'type' => FileInput::className(),
- 'value' => function ($data) {
- if (!$data || !isset($data['id'])) return null;
-
- $file = Files::findOne([
- 'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO,
- 'entity_id' => $data['id']
- ]);
-
- if (!$file) return null;
-
- // Return just the basic file information
- return [
- 'caption' => basename($file->url),
- 'url' => $file->url
- ];
- },
- 'options' => [
- 'options' => [
- 'multiple' => false,
- 'accept' => 'video/*',
- 'name' => 'video_name'
- ],
- 'pluginOptions' => [
- 'showPreview' => true,
- 'showCaption' => true,
- 'showRemove' => true,
- 'showUpload' => true,
- 'previewFileType' => 'video',
- 'allowedFileTypes' => ['video'],
- 'allowedFileExtensions' => ['mp4', 'mov', 'avi'],
- 'maxFileSize' => 10240, // 10MB
- 'initialPreview' => function($data) {
- if (!$data || !isset($data['id'])) return [];
- $file = Files::findOne([
- 'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO,
- 'entity_id' => $data['id']
- ]);
- return $file ? [$file->url] : [];
- },
- 'initialPreviewConfig' => function($data) {
- if (!$data || !isset($data['id'])) return [];
- $file = Files::findOne([
- 'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO,
- 'entity_id' => $data['id']
- ]);
- return $file ? [[
- 'type' => 'video',
- 'caption' => basename($file->url),
- 'url' => Url::to(['delete-video', 'id' => $data['id']])
- ]] : [];
- }
- ],
- ],
-],
+ [
+ 'name' => 'video',
+ 'title' => 'Видео',
+ 'type' => 'fileInput',
+ 'options' => [
+ 'options' => [
+ 'accept' => 'video/*',
+ 'multiple' => false,
+ ],
+ ],
+ 'value' => function ($data) {
+ if (empty($data['id'])) return null;
+
+ $file = Files::findOne([
+ 'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO,
+ 'entity_id' => $data['id']
+ ]);
+
+ return $file ? basename($file->url) : null;
+ }
+ ],
[
'name' => 'comment',
'type' => 'textInput',