use Cubist\Backpack\Magic\Fields\FieldGroupStart;
use Cubist\Backpack\Magic\Fields\FilesOrURL;
use Cubist\Backpack\Magic\Fields\FormSection;
+use Cubist\Backpack\Magic\Fields\Number;
use Cubist\Backpack\Magic\Fields\Text;
use Cubist\Backpack\Magic\Fields\Textarea;
use Cubist\Backpack\Magic\Form;
const ANCHOR = 40;
const FLIPCARD = 41;
+
/**
* @var int
*/
protected $_addedContents = true;
protected $_tooltip = true;
+ protected static $_acceptImage = ['.jpg', '.jpeg', '.png', '.svg', '.gif'];
+ protected static $_acceptImageAZip = ['.jpg', '.jpeg', '.png', '.svg', '.gif', '.zip'];
+ protected static $_acceptAnimation = ['.jpg', '.jpeg', '.png', '.svg', '.gif', '.zip', '.oam', '.html', '.json'];
+ protected static $_acceptVideo = ['.mp4'];
+ protected static $_acceptFont = ['.otf', '.ttf'];
+ protected static $_acceptAudiodescription = ['.mp3', '.txt'];
+ protected static $_acceptAudio = ['.mp3'];
+ protected static $_acceptHtml = ['.html'];
+ protected static $_acceptIframe = ['.oam', '.zip', '.html', '.pdf'];
+ protected static $_acceptSlideshow = ['.zip'];
+ protected static $_acceptPDF = ['.pdf'];
+
+
/**
* @return array[]
*/
{
$res = [
['type' => self::WEB, 'label' => __('Lien web'), 'color' => '#3399cc', 'class' => Web::class, 'order' => 1],
- ['type' => self::INTERNAL, 'label' => __('Lien vers une page'), 'color' => '#c7b405', 'class' => Web::class, 'order' => 2],
+ ['type' => self::INTERNAL, 'label' => __('Lien vers une page'), 'color' => '#c7b405', 'class' => Internal::class, 'order' => 2],
['type' => self::EMAIL, 'label' => __('Adresse e-mail'), 'color' => '#6c6360', 'class' => Email::class, 'order' => 3],
['type' => self::WEB_INFOS, 'label' => __('Lien web « plus d\'infos »'), 'color' => '#ff0000', 'class' => WebInfos::class],
['type' => self::COLOR, 'label' => __('Couleur'), 'color' => '#8C5E24', 'class' => Web::class, 'order' => 4],
['type' => self::VIDEO, 'label' => __('Vidéo'), 'color' => '#33ff00', 'class' => Video::class],
- ['type' => self::MULTIMEDIA, 'label' => __('Multimédia'), 'color' => '#ff00ff', 'class' => Web::class],
+ ['type' => self::MULTIMEDIA, 'label' => __('Multimédia'), 'color' => '#ff00ff', 'class' => Multimedia::class],
['type' => 'separator', 'order' => 5],
['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::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' => WebVideo::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::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::FILE, 'label' => __('Fichier'), 'color' => '#F19043', 'class' => File::class],
+ ['type' => self::AUDIO, 'label' => __('Audio'), 'color' => '#0065AE', 'class' => Audio::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::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::PHONE, 'label' => __('Téléphone'), 'color' => '#000000', 'class' => Phone::class],
+ ['type' => self::AUDIODESCRIPTION, 'label' => __('Audiodescription'), 'color' => '#00535b', 'class' => Audiodescription::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::SLIDESHOW, 'label' => __('Diaporama'), 'color' => '#07b57a', 'class' => Slideshow::class],
+ ['type' => self::IFRAME, 'label' => __('iFrame'), 'color' => '#fcae25', 'class' => IFrame::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::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],
+ ['type' => self::FLIPCARD, 'label' => __('Flipcard'), 'color' => '#460e3f', 'class' => Flipcard::class],
];
usort($res, function ($a, $b) {
{
$this->addTypeField();
$this->addSettingsFields();
- $this->addAppearanceFields();
$this->addTooltipFields();
$this->addPositionFields();
$this->addExtraFields();
{
$this->addField('header_settings', FormSection::class, __('Paramètres'));
$this->addDestinationField();
- $this->addUIDField();
$this->addBasicSettingsFields();
}
public function addBasicSettingsFields()
{
+ if ($this->_integration) {
+ $this->addField('inline', MultimediaIntegration::class, __('Intégration'));
+ }
+ $this->addUIDField();
if ($this->_addedContents) {
$this->addField('header_contents', FormSection::class, __('Contenus superposés'));
- $this->addField('image', FilesOrURL::class, __('Image'), array_merge($this->getFilesOrURLEntry(), ['accept' => ['.jpg', '.jpeg', '.png', '.svg', '.gif']]));
+ $this->addField('image', FilesOrURL::class, __('Image'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptImage]);
$this->addField('image_rollover', RolloverAnimation::class, __('Animation de l\'image au survol'));
- $this->addField('animation', FilesOrURL::class, __('Animation'), array_merge($this->getFilesOrURLEntry(), ['accept' => ['.html']]));
- }
- if ($this->_integration) {
- $this->addField('inline', MultimediaIntegration::class, __('Intégration'));
+ $this->addField('animation', FilesOrURL::class, __('Animation'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptHtml]);
}
if ($this->_multimedia) {
$this->addMultimediaFields();
public function addMultimediaFields()
{
$this->addField('header_video', FormSection::class, __('Paramètres multimedia'));
+
}
- public function addAppearanceFields()
+ public function addMultimediaSizeFields()
{
- $this->addField('header_appearance', FormSection::class, __('Apparence'));
+ $this->addField('video_width', Number::class, __('Largeur de la vidéo'));
+ $this->addField('video_height', Number::class, __('Hauteur de la vidéo'));
}
+
public function addPositionFields()
{
$this->addField('header_disposition', FormSection::class, __('Disposition'));
public function addExtraFields()
{
+ if ($this->hasField('extra')) {
+ return;
+ }
$this->addField('header_extra', FormSection::class, __('Autres paramètres'));
$this->addField('extra', Textarea::class, '');
}