]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5468 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 19 Sep 2022 13:29:53 +0000 (15:29 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 19 Sep 2022 13:29:53 +0000 (15:29 +0200)
app/SubForms/Link/Base.php
app/SubForms/Link/Email.php [new file with mode: 0644]
app/SubForms/Link/Video.php [new file with mode: 0644]
app/SubForms/Link/Web.php [new file with mode: 0644]
app/SubForms/Link/WebInfos.php [new file with mode: 0644]
app/SubForms/Link/WebLink.php [deleted file]

index dd26cee8984ef20de61b68237729d4136852ba1a..c58051f459db4684aa50931bbb4f6c1a6c3598a6 100644 (file)
@@ -4,6 +4,7 @@ namespace App\SubForms\Link;
 
 use App\Fields\FluidbookLinkEditor\Depth;
 use App\Fields\FluidbookLinkEditor\LinkType;
+use App\Fields\FluidbookLinkEditor\MultimediaIntegration;
 use Cubist\Backpack\Magic\Fields\FormSection;
 use Cubist\Backpack\Magic\Fields\Number;
 use Cubist\Backpack\Magic\Fields\Text;
@@ -58,6 +59,8 @@ class Base extends SubForm
     const FLIPCARD = 41;
 
     protected $_displayedOnFluidbook = true;
+    protected $_integration = false;
+    protected $_multimedia = false;
 
     /**
      * @return array[]
@@ -65,48 +68,47 @@ class Base extends SubForm
     public static function types()
     {
         return [
-            ['type' => self::WEB_INFOS, 'label' => __('Lien web « plus d\'infos »'), 'color' => '#ff0000'],
-            ['type' => self::WEB, 'label' => __('Lien web'), 'color' => '#3399cc'],
-            ['type' => self::EMAIL, 'label' => __('Adresse e-mail'), 'color' => '#6c6360'],
-            ['type' => self::VIDEO, 'label' => __('Vidéo'), 'color' => '#33ff00'],
-            ['type' => self::INTERNAL, 'label' => __('Lien vers une page'), 'color' => '#c7b405'],
-            ['type' => self::MULTIMEDIA, 'label' => __('Multimédia'), 'color' => '#ff00ff'],
-            ['type' => self::CUSTOM, 'label' => __('Lien personnalisé'), 'color' => '#14511a'],
-            ['type' => self::PAGE_CORNER, 'label' => __('Coin de page'), 'color' => '#f19043', 'disabled' => true],
-            ['type' => self::OBJECT3D, 'label' => __('Objet 3D'), 'color' => '#00ffff', 'disabled' => true],
-            ['type' => self::WEBVIDEO, 'label' => __('Vidéo web'), 'color' => '#ffff00'],
-            ['type' => self::ACTION, 'label' => __('Action'), 'color' => '#880000'],
-            ['type' => self::CART, 'label' => __('Panier'), 'color' => '#F2A4B7'],
-            ['type' => self::ZOOM, 'label' => __('Zone de zoom'), 'color' => '#322280'],
-            ['type' => self::COLOR, 'label' => __('Couleurs'), 'color' => '#8C5E24'],
-            ['type' => self::IMAGE, 'label' => __('Image'), 'color' => '#BE418D'],
-            ['type' => self::FILE, 'label' => __('Fichier'), 'color' => '#F19043'],
-            ['type' => self::AUDIO, 'label' => __('Audio'), 'color' => '#0065AE'],
-            ['type' => self::TOOLTIP, 'label' => __('Texte / Infobulle'), 'color' => '#000000'],
-            ['type' => self::CALL, 'label' => __('Appel'), 'color' => '#333333'],
-            ['type' => self::BOOKMARKGROUP, 'label' => __('Groupe de marque-pages'), 'color' => '#d6520f'],
-            ['type' => self::HTML5MULTIMEDIA, 'label' => __('Lien Multimédia (HTML)'), 'color' => '#34A853', 'disabled' => true],
-            ['type' => self::BOOKMARK_CORNER, 'label' => __('Lien marque-page sur coin de page'), 'color' => '#000000', 'disabled' => true],
-            ['type' => self::STATSTAG, 'label' => __('Tag statistique'), 'color' => '#000000'],
-            ['type' => self::PHONE, 'label' => __('Téléphone'), 'color' => '#000000'],
-            ['type' => self::AUDIODESCRIPTION, 'label' => __('Audiodescription'), 'color' => '#00535b'],
-            ['type' => self::PAGE_LABEL, 'label' => __('Label de page'), 'color' => '#00E6D7'],
-            ['type' => self::EVENT_OVERLAY, 'label' => __('Capter les évenements'), 'color' => '#ffcc00'],
-            ['type' => self::ARTICLE, 'label' => __('Article (définition)'), 'color' => '#ACC152'],
-            ['type' => self::LIKE, 'label' => __('Like'), 'color' => '#4267B2'],
-            ['type' => self::SLIDESHOW, 'label' => __('Diaporama'), 'color' => '#07b57a'],
-            ['type' => self::IFRAME, 'label' => __('iFrame'), 'color' => '#fcae25'],
-            ['type' => self::SHOWLINK, 'label' => __('Afficher un lien'), 'color' => '#125C70'],
-            ['type' => self::ZOOMHD, 'label' => __('Zoom HD'), 'color' => '#E80C95'],
-            ['type' => self::LOCK_CONTENTS, 'label' => __('Blocage des contenus'), 'color' => '#69D670'],
-            ['type' => self::TEXT, 'label' => __('Texte'), 'color' => '#9090FF'],
-            ['type' => self::ARTICLE_OPEN, 'label' => __('Afficher un article'), 'color' => '#ffcc00'],
-            ['type' => self::DOWNLOAD_PORTION, 'label' => __('Télécharger un extrait'), 'color' => '#AAAAAA'],
-            ['type' => self::TRIGGERSLINK, 'label' => __('Déclencher un lien'), 'color' => '#cc0000'],
-            ['type' => self::LAYER, 'label' => __('Animation de calque'), 'color' => '#3D0254'],
-            ['type' => self::ANCHOR, 'label' => __('Ancre'), 'color' => '#330000'],
-            ['type' => self::FLIPCARD, 'label' => __('Flipcard'), 'color' => '#460e3f'],
-
+            ['type' => self::WEB_INFOS, 'label' => __('Lien web « plus d\'infos »'), 'color' => '#ff0000', 'class' => WebInfos::class, 'class' => Web::class],
+            ['type' => self::WEB, 'label' => __('Lien web'), 'color' => '#3399cc', 'class' => Web::class, 'class' => Web::class],
+            ['type' => self::EMAIL, 'label' => __('Adresse e-mail'), 'color' => '#6c6360', 'class' => Web::class],
+            ['type' => self::VIDEO, 'label' => __('Vidéo'), 'color' => '#33ff00', 'class' => Web::class],
+            ['type' => self::INTERNAL, 'label' => __('Lien vers une page'), 'color' => '#c7b405', 'class' => Web::class],
+            ['type' => self::MULTIMEDIA, 'label' => __('Multimédia'), 'color' => '#ff00ff', 'class' => Web::class],
+            ['type' => self::CUSTOM, 'label' => __('Lien personnalisé'), 'color' => '#14511a', 'class' => Web::class],
+            ['type' => self::PAGE_CORNER, 'label' => __('Coin de page'), 'color' => '#f19043', 'disabled' => true, 'class' => Web::class],
+            ['type' => self::OBJECT3D, 'label' => __('Objet 3D'), 'color' => '#00ffff', 'disabled' => true, 'class' => Web::class],
+            ['type' => self::WEBVIDEO, 'label' => __('Vidéo web'), 'color' => '#ffff00', 'class' => Web::class],
+            ['type' => self::ACTION, 'label' => __('Action'), 'color' => '#880000', 'class' => Web::class],
+            ['type' => self::CART, 'label' => __('Panier'), 'color' => '#F2A4B7', 'class' => Web::class],
+            ['type' => self::ZOOM, 'label' => __('Zone de zoom'), 'color' => '#322280', 'class' => Web::class],
+            ['type' => self::COLOR, 'label' => __('Couleurs'), 'color' => '#8C5E24', 'class' => Web::class],
+            ['type' => self::IMAGE, 'label' => __('Image'), 'color' => '#BE418D', 'class' => Web::class],
+            ['type' => self::FILE, 'label' => __('Fichier'), 'color' => '#F19043', 'class' => Web::class],
+            ['type' => self::AUDIO, 'label' => __('Audio'), 'color' => '#0065AE', 'class' => Web::class],
+            ['type' => self::TOOLTIP, 'label' => __('Texte / Infobulle'), 'color' => '#000000', 'class' => Web::class],
+            ['type' => self::CALL, 'label' => __('Appel'), 'color' => '#333333', 'class' => Web::class],
+            ['type' => self::BOOKMARKGROUP, 'label' => __('Groupe de marque-pages'), 'color' => '#d6520f', 'class' => Web::class],
+            ['type' => self::HTML5MULTIMEDIA, 'label' => __('Lien Multimédia (HTML)'), 'color' => '#34A853', 'disabled' => true, 'class' => Web::class],
+            ['type' => self::BOOKMARK_CORNER, 'label' => __('Lien marque-page sur coin de page'), 'color' => '#000000', 'disabled' => true, 'class' => Web::class],
+            ['type' => self::STATSTAG, 'label' => __('Tag statistique'), 'color' => '#000000', 'class' => Web::class],
+            ['type' => self::PHONE, 'label' => __('Téléphone'), 'color' => '#000000', 'class' => Web::class],
+            ['type' => self::AUDIODESCRIPTION, 'label' => __('Audiodescription'), 'color' => '#00535b', 'class' => Web::class],
+            ['type' => self::PAGE_LABEL, 'label' => __('Label de page'), 'color' => '#00E6D7', 'class' => Web::class],
+            ['type' => self::EVENT_OVERLAY, 'label' => __('Capter les évenements'), 'color' => '#ffcc00', 'class' => Web::class],
+            ['type' => self::ARTICLE, 'label' => __('Article (définition)'), 'color' => '#ACC152', 'class' => Web::class],
+            ['type' => self::LIKE, 'label' => __('Like'), 'color' => '#4267B2', 'class' => Web::class],
+            ['type' => self::SLIDESHOW, 'label' => __('Diaporama'), 'color' => '#07b57a', 'class' => Web::class],
+            ['type' => self::IFRAME, 'label' => __('iFrame'), 'color' => '#fcae25', 'class' => Web::class],
+            ['type' => self::SHOWLINK, 'label' => __('Afficher un lien'), 'color' => '#125C70', 'class' => Web::class],
+            ['type' => self::ZOOMHD, 'label' => __('Zoom HD'), 'color' => '#E80C95', 'class' => Web::class],
+            ['type' => self::LOCK_CONTENTS, 'label' => __('Blocage des contenus'), 'color' => '#69D670', 'class' => Web::class],
+            ['type' => self::TEXT, 'label' => __('Texte'), 'color' => '#9090FF', 'class' => Web::class],
+            ['type' => self::ARTICLE_OPEN, 'label' => __('Afficher un article'), 'color' => '#ffcc00', 'class' => Web::class],
+            ['type' => self::DOWNLOAD_PORTION, 'label' => __('Télécharger un extrait'), 'color' => '#AAAAAA', 'class' => Web::class],
+            ['type' => self::TRIGGERSLINK, 'label' => __('Déclencher un lien'), 'color' => '#cc0000', 'class' => Web::class],
+            ['type' => self::LAYER, 'label' => __('Animation de calque'), 'color' => '#3D0254', 'class' => Web::class],
+            ['type' => self::ANCHOR, 'label' => __('Ancre'), 'color' => '#330000', 'class' => Web::class],
+            ['type' => self::FLIPCARD, 'label' => __('Flipcard'), 'color' => '#460e3f', 'class' => Web::class],
         ];
     }
 
@@ -146,7 +148,17 @@ class Base extends SubForm
 
     public function addBasicSettingsFields()
     {
+        if ($this->_integration) {
+            $this->addField('inline', MultimediaIntegration::class, __('Intégration'), ['default' => 'inline']);
+        }
+        if ($this->_multimedia) {
+            $this->addMultimediaFields();
+        }
+    }
 
+    public function addMultimediaFields()
+    {
+        $this->addField('header_video', FormSection::class, __('Paramètres multimedia'));
     }
 
     public function addAppearanceFields()
diff --git a/app/SubForms/Link/Email.php b/app/SubForms/Link/Email.php
new file mode 100644 (file)
index 0000000..04b6cda
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+
+namespace App\SubForms\Link;
+
+use Cubist\Backpack\Magic\Fields\URL;
+
+class Email extends Web
+{
+    public $type = self::EMAIL;
+
+    public function addDestinationField()
+    {
+        $this->addField('to', \Cubist\Backpack\Magic\Fields\Email::class, __('Adresse e-mail'));
+    }
+}
diff --git a/app/SubForms/Link/Video.php b/app/SubForms/Link/Video.php
new file mode 100644 (file)
index 0000000..8f39e4f
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+namespace App\SubForms\Link;
+
+use Cubist\Backpack\Magic\Fields\Checkbox;
+
+class Video extends Base
+{
+    public $type = self::VIDEO;
+    public $_integration = true;
+    public $_multimedia = true;
+
+    public function addMultimediaFields()
+    {
+        parent::addMultimediaFields();
+        $this->addField('video_auto_start', Checkbox::class, __('Jouer la vidéo automatiquement'), ['default' => true]);
+        $this->addField('video_controls', Checkbox::class, __('Afficher les contrôles de la vidéo'), ['default' => true]);
+        $this->addField('video_sound_on', Checkbox::class, __('Activer le son de la vidéo'), ['default' => true]);
+        $this->addField('video_loop', Checkbox::class, __('Jouer la vidéo en boucle'), ['default' => false]);
+    }
+}
diff --git a/app/SubForms/Link/Web.php b/app/SubForms/Link/Web.php
new file mode 100644 (file)
index 0000000..034f406
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+
+namespace App\SubForms\Link;
+
+use Cubist\Backpack\Magic\Fields\URL;
+
+class Web extends Base
+{
+    public $type = self::WEB;
+
+    public function addDestinationField()
+    {
+        $this->addField('to', URL::class, __('Adresse'));
+    }
+}
diff --git a/app/SubForms/Link/WebInfos.php b/app/SubForms/Link/WebInfos.php
new file mode 100644 (file)
index 0000000..7f4eeff
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+
+namespace App\SubForms\Link;
+
+class WebInfos extends Web
+{
+    public $type = self::WEB_INFOS;
+}
diff --git a/app/SubForms/Link/WebLink.php b/app/SubForms/Link/WebLink.php
deleted file mode 100644 (file)
index b3cde2c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-namespace App\SubForms\Link;
-
-class WebLink
-{
-
-}