From c288921d5a1d81773e4116672c175837219017f8 Mon Sep 17 00:00:00 2001 From: Tony Air Date: Fri, 8 Jul 2022 20:48:26 +0200 Subject: [PATCH] IMPR: Add video files --- _config/config.yml | 3 +++ src/Extensions/SlideImageEx.php | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/_config/config.yml b/_config/config.yml index 0f2e251..6846a0a 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -72,3 +72,6 @@ SilverStripe\Assets\File: - LeKoala\FilePond\FilePondFileExtension LeKoala\FilePond\FilePondField: enable_auto_thumbnails: true + +Dynamic\FlexSlider\Model\SlideImage: + max_video_size: 300000000 diff --git a/src/Extensions/SlideImageEx.php b/src/Extensions/SlideImageEx.php index 0df9b1b..2e76b1d 100755 --- a/src/Extensions/SlideImageEx.php +++ b/src/Extensions/SlideImageEx.php @@ -9,8 +9,10 @@ namespace A2nt\ElementalBasics\Extensions; use A2nt\ElementalBasics\Elements\SliderElement; +use Dynamic\FlexSlider\Model\SlideImage; use LeKoala\FilePond\FilePondField; use SilverStripe\Assets\File; +use SilverStripe\Core\Config\Config; use SilverStripe\Forms\CheckboxField; use SilverStripe\Forms\DatetimeField; use SilverStripe\Forms\ToggleCompositeField; @@ -117,7 +119,7 @@ class SlideImageEx extends DataExtension ->setFolderName('Uploads/SlideVideos'); $validator = $videoUpload->getValidator(); - $validator->setAllowedMaxFileSize(['mp4' => 300000000]); + $validator->setAllowedMaxFileSize(['mp4' => Config::inst()->get(SlideImage::class, 'max_video_size')]); $maxFileSize = $validator->getAllowedMaxFileSize('mp4'); $videoUpload->setTitle('Video File (max size: '.self::formatBytes($maxFileSize).')');