From e1f0fed2bbb3bb176677b79baaf209fdc412a5d2 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 25 Apr 2025 10:27:43 +0200 Subject: [PATCH] wip #7259 @1 --- app/SubForms/Link/Video.php | 9 ++++++++- app/SubForms/VideoTrack.php | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 app/SubForms/VideoTrack.php diff --git a/app/SubForms/Link/Video.php b/app/SubForms/Link/Video.php index a4599a3ef..2edcb66d0 100644 --- a/app/SubForms/Link/Video.php +++ b/app/SubForms/Link/Video.php @@ -3,8 +3,11 @@ namespace App\SubForms\Link; use App\Fluidbook\Link\Link; +use App\SubForms\VideoTrack; +use Cubist\Backpack\Magic\Fields\BunchOfFieldsMultiple; use Cubist\Backpack\Magic\Fields\CheckboxBasic; use Cubist\Backpack\Magic\Fields\FilesOrURL; +use Cubist\Backpack\Magic\Fields\FormSection; // __('!! Editeur de liens') class Video extends Base @@ -15,8 +18,9 @@ class Video extends Base public function addDestinationField() { + VideoTrack::$_filesOrURLAttributes = $this->getFilesOrURLEntry(); + $this->addField('to', FilesOrURL::class, __('Fichier vidéo'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptVideo]); - $this->addField('tracks', FilesOrURL::class, __('Sous-titres'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptSubtitles]); } public function addMultimediaFields() @@ -28,5 +32,8 @@ class Video extends Base $this->addField('video_loop', CheckboxBasic::class, __('Jouer la vidéo en boucle'), ['default' => false]); $this->addMultimediaSizeFields(); + + $this->addField('header_tracks', FormSection::class, __('Pistes de sous-titres, descriptions et chapitres')); + $this->addField('tracks', BunchOfFieldsMultiple::class, '', ['bunch' => VideoTrack::class, 'add_label' => __('Ajouter une piste'),'edit_label'=>'%kind : %label']); } } diff --git a/app/SubForms/VideoTrack.php b/app/SubForms/VideoTrack.php new file mode 100644 index 000000000..3c58e7140 --- /dev/null +++ b/app/SubForms/VideoTrack.php @@ -0,0 +1,26 @@ +addField('label', Text::class, __('Label'),['hint'=>__('Texte affiché dans le lecteur vidéo pour désigner la piste. (Recommandé)')]); + $this->addField('file', FilesOrURL::class, __('Fichier'), self::$_filesOrURLAttributes + ['accept' => ['.vtt']]); + $this->addField('kind', SelectFromArray::class, __('Type'), ['default' => 'captions', 'allows_null' => false, 'ajax' => false, 'options' => ['captions' => 'Captions', 'subtitles' => 'Subtitles', 'descriptions' => 'Descriptions', 'chapters' => 'Chapters']]); + $this->addField('srclang', Locale::class, __('Langue'), ['allows_null' => true, 'ajax' => false, 'hint' => __('Laisser vide pour utiliser la langue de la publication')]);; + } + + +} -- 2.39.5