From: Vincent Vanwaelscappel Date: Mon, 19 Sep 2022 08:54:17 +0000 (+0200) Subject: wip #5468 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=b5733b349c28b3b538b1f15b0ecf7b1cfe54fe6d;p=fluidbook-toolbox.git wip #5468 @0.5 --- diff --git a/app/SubForms/Link/Base.php b/app/SubForms/Link/Base.php index de15d108e..dd26cee89 100644 --- a/app/SubForms/Link/Base.php +++ b/app/SubForms/Link/Base.php @@ -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 index 000000000..b3cde2c8f --- /dev/null +++ b/app/SubForms/Link/WebLink.php @@ -0,0 +1,8 @@ +