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;
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'],
];
}
+
+ 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'));
+ }
}