]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5468 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 19 Sep 2022 08:54:17 +0000 (10:54 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 19 Sep 2022 08:54:17 +0000 (10:54 +0200)
app/SubForms/Link/Base.php
app/SubForms/Link/WebLink.php [new file with mode: 0644]

index de15d108e83d3149a6f6115610b0e0c5c98f9243..dd26cee8984ef20de61b68237729d4136852ba1a 100644 (file)
@@ -2,12 +2,18 @@
 
 namespace App\SubForms\Link;
 
+use App\Fields\FluidbookLinkEditor\Depth;
+use App\Fields\FluidbookLinkEditor\LinkType;
+use Cubist\Backpack\Magic\Fields\FormSection;
+use Cubist\Backpack\Magic\Fields\Number;
+use Cubist\Backpack\Magic\Fields\Text;
 use Cubist\Backpack\Magic\SubForm;
 
 class Base extends SubForm
 {
-    const GENERAL_INFOS = 1;
+    const WEB_INFOS = 1;
     const PRODUCT = 1;
+    const WEB = 2;
     const GENERAL = 2;
     const EMAIL = 3;
     const VIDEO = 4;
@@ -51,14 +57,16 @@ class Base extends SubForm
     const ANCHOR = 40;
     const FLIPCARD = 41;
 
+    protected $_displayedOnFluidbook = true;
+
     /**
      * @return array[]
      */
     public static function types()
     {
         return [
-            ['type' => self::GENERAL_INFOS, 'label' => __('Lien web « plus d\'infos »'), 'color' => '#ff0000'],
-            ['type' => self::GENERAL, 'label' => __('Lien web'), 'color' => '#3399cc'],
+            ['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'],
@@ -101,4 +109,66 @@ class Base extends SubForm
 
         ];
     }
+
+    public function init()
+    {
+        parent::init();
+        $this->addTypeField();
+        $this->addSettingsFields();
+        $this->addAppearanceFields();
+        $this->addPositionFields();
+        $this->addPositionFields();
+        $this->addExtraFields();
+    }
+
+    public function addTypeField()
+    {
+        $this->addField('type', LinkType::class, __('Type de lien'));
+    }
+
+    public function addDestinationField()
+    {
+        $this->addField('to', Text::class, __('Destination'));
+    }
+
+    public function addUIDField()
+    {
+        $this->addField('uid', Text::class, __('Identifiant unique'));
+    }
+
+    public function addSettingsFields()
+    {
+        $this->addField('header_settings', FormSection::class, __('Paramètres'));
+        $this->addDestinationField();
+        $this->addUIDField();
+        $this->addBasicSettingsFields();
+    }
+
+    public function addBasicSettingsFields()
+    {
+
+    }
+
+    public function addAppearanceFields()
+    {
+        $this->addField('header_settings', FormSection::class, __('Apparence'));
+    }
+
+    public function addPositionFields()
+    {
+        $this->addField('header_settings', FormSection::class, __('Disposition'));
+        $this->addField('x', Number::class, 'X');
+        $this->addField('y', Number::class, 'Y');
+        $this->addField('w', Number::class, 'W', ['min' => 0]);
+        $this->addField('h', Number::class, 'H', ['min' => 0]);
+        if ($this->_displayedOnFluidbook) {
+            $this->addField('rot', Number::class, __('Rotation'), ['min' => 0, 'max' => 360, 'suffix' => '°']);
+            $this->addField('zindex', Depth::class, __('Profondeur'));
+        }
+    }
+
+    public function addExtraFields()
+    {
+        $this->addField('header_settings', FormSection::class, __('Autres paramètres'));
+    }
 }
diff --git a/app/SubForms/Link/WebLink.php b/app/SubForms/Link/WebLink.php
new file mode 100644 (file)
index 0000000..b3cde2c
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+
+namespace App\SubForms\Link;
+
+class WebLink
+{
+
+}