<?php

declare(strict_types=1);

use Contao\System;

$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'vr_bw_addImage';
$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'vr_bw_minHeight';
$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'vr_bw_width';
$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'vr_bw_bgBesideContent';
$GLOBALS['TL_DCA']['tl_content']['palettes']['background_wrapper'] = '
    {type_legend},type,headline;
    {background_legend},vr_bw_addImage,vr_bw_bgColor,vr_bw_bgWidthRestriction;
    {content_legend},vr_bw_minHeight,vr_bw_width,vr_bw_vAlign,vr_bw_padding,vr_bw_colorInvert;
    {template_legend:hide},customTpl;
    {protected_legend:hide},protected;
    {expert_legend:hide},cssID;
    {invisible_legend:hide},invisible,start,stop
';

$GLOBALS['TL_DCA']['tl_content']['palettes']['grid_placement_wrapper'] = '
    {type_legend},type,headline;
    {grid_placement_legend},vr_gpw_grid,vr_gpw_tablet_grid,vr_gpw_mobile_grid,vr_gpw_desktop_vAlign,vr_gpw_tablet_vAlign,vr_gpw_mobile_vAlign;
    {template_legend:hide},customTpl;
    {protected_legend:hide},protected;
    {expert_legend:hide},cssID;
    {invisible_legend:hide},invisible,start,stop
';

$GLOBALS['TL_DCA']['tl_content']['palettes']['display_text'] = '
    {type_legend},type;
    {display_text_legend},vr_dt_plainText,vr_dt_size;
    {template_legend:hide},customTpl;
    {protected_legend:hide},protected;
    {expert_legend:hide},cssID;
    {invisible_legend:hide},invisible,start,stop
';

$GLOBALS['TL_DCA']['tl_content']['subpalettes']['vr_bw_addImage'] = 'vr_bw_bgSRC,size,vr_bw_bgSize,vr_bw_bgPos,vr_bw_bgOpacity,vr_bw_bgBesideContent';
$GLOBALS['TL_DCA']['tl_content']['subpalettes']['vr_bw_bgBesideContent'] = 'vr_bw_bgHorizontalPosition,vr_bw_bgAsideContentResponsive';
$GLOBALS['TL_DCA']['tl_content']['subpalettes']['vr_bw_minHeight_-mh-ratio'] = 'vr_bw_mh_ratio';
$GLOBALS['TL_DCA']['tl_content']['subpalettes']['vr_bw_minHeight_-mh-vh'] = 'vr_bw_mh_viewport';
$GLOBALS['TL_DCA']['tl_content']['subpalettes']['vr_bw_width_-width-extended'] = 'vr_bw_widthText';
$GLOBALS['TL_DCA']['tl_content']['subpalettes']['vr_bw_width_-width-default-left'] = 'vr_bw_widthText';
$GLOBALS['TL_DCA']['tl_content']['subpalettes']['vr_bw_width_-width-default-right'] = 'vr_bw_widthText';
$GLOBALS['TL_DCA']['tl_content']['subpalettes']['vr_bw_width_-width-extended-left'] = 'vr_bw_widthText';
$GLOBALS['TL_DCA']['tl_content']['subpalettes']['vr_bw_width_-width-extended-right'] = 'vr_bw_widthText';

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_addImage'] = [
    'inputType'               => 'checkbox',
    'eval'                    => ['submitOnChange' =>true],
    'sql'                     => ['type' => 'boolean', 'default' => false]
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_bgSRC'] = [
    'inputType' => 'fileTree',
    'eval'      => [
        'tl_class'   => 'clr',
        'multiple'   => false,
        'fieldType'  => 'radio',
        'filesOnly'  => true,
        'extensions' => array_merge(System::getContainer()->getParameter('contao.image.valid_extensions'),['mp4', 'm4v', 'mov', 'wmv', 'webm', 'ogv']),
    ],
    'sql'       => "binary(16) NULL"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_bgSize'] = [
    'inputType' => 'select',
    'options'   => [
        ''          => 'Beschnitten',
        '-bg-size-contain'   => 'Proportional',
        '-bg-size-stretch' => 'Verzerrt',
        '-bg-size-auto' => 'Originalgröße',
    ],
    'eval'      => ['tl_class' => 'w50'],
    'sql'       => "varchar(16) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_bgPos'] = [
    'inputType' => 'select',
    'options'   => [
        '-bg-pos-0-0'       => 'Links | Oben',
        '-bg-pos-50-0'     => 'Mitte | Oben',
        '-bg-pos-100-0'    => 'Rechts | Oben',
        '-bg-pos-0-50'     => 'Links | Mitte',
        '-bg-pos-50-50'   => 'Mitte | Mitte',
        '-bg-pos-100-50'  => 'Rechts | Mitte',
        '-bg-pos-0-100'    => 'Links | Unten',
        '-bg-pos-50-100'  => 'Mitte | Unten',
        '-bg-pos-100-100' => 'Rechts | Unten',
    ],
    'eval'      => ['tl_class' => 'w50', 'includeBlankOption' => true],
    'sql'       => "varchar(16) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_bgOpacity'] = [
    'inputType' => 'select',
    'options'   => [
        '-bg-opacity-10'  => '10%',
        '-bg-opacity-20'  => '20%',
        '-bg-opacity-30'  => '30%',
        '-bg-opacity-40'  => '40%',
        '-bg-opacity-50'  => '50%',
        '-bg-opacity-60'  => '60%',
        '-bg-opacity-70'  => '70%',
        '-bg-opacity-80'  => '80%',
        '-bg-opacity-90'  => '90%',
        '-bg-opacity-100' => '100%',
    ],
    'eval'      => ['tl_class' => 'w50', 'includeBlankOption' => true],
    'sql'       => "varchar(16) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_bgBesideContent'] = [
    'inputType'               => 'checkbox',
    'eval'                    => ['tl_class' => 'w50','submitOnChange' =>true],
    'sql'                     => ['type' => 'boolean', 'default' => false]
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_bgHorizontalPosition'] = [
    'inputType' => 'select',
    'options'   => [
        ''          => 'Links',
        '-bg-horizontal-align-right'   => 'Rechts',
    ],
    'eval'      => ['tl_class' => 'w50'],
    'sql'       => "varchar(32) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_bgAsideContentResponsive'] = [
    'inputType' => 'select',
    'options'   => [
        ''          => 'Unten',
        '-bg-aside-content-reverse'   => 'Oben',
    ],
    'eval'      => ['tl_class' => 'w50'],
    'sql'       => "varchar(32) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_bgHorizontalWidth'] = [
    'inputType' => 'select',
    'default'   => '-bg-horizontal-width-50',
    'options'   => [
        '-bg-horizontal-width-5'  => '5%',
        '-bg-horizontal-width-10'  => '10%',
        '-bg-horizontal-width-15'  => '15%',
        '-bg-horizontal-width-20'  => '20%',
        '-bg-horizontal-width-25'  => '25%',
        '-bg-horizontal-width-30'  => '30%',
        '-bg-horizontal-width-35'  => '35%',
        '-bg-horizontal-width-40'  => '40%',
        '-bg-horizontal-width-45'  => '45%',
        '-bg-horizontal-width-50'  => '50%',
        '-bg-horizontal-width-55'  => '55%',
        '-bg-horizontal-width-60'  => '60%',
        '-bg-horizontal-width-65'  => '65%',
        '-bg-horizontal-width-70'  => '70%',
        '-bg-horizontal-width-75'  => '75%',
        '-bg-horizontal-width-80'  => '80%',
        '-bg-horizontal-width-85'  => '85%',
        '-bg-horizontal-width-90'  => '90%',
        '-bg-horizontal-width-95'  => '95%',
        '-bg-horizontal-width-100' => '100%',
    ],
    'eval'      => ['tl_class' => 'w50'],
    'sql'       => "varchar(32) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_bgColor'] = [
    'inputType' => 'select',
    'options'   => [
        '-alt-color-1'  => 'Alternative 1',
        '-alt-color-2' => 'Alternative 2',
        '-alt-color-3' => 'Alternative 3',
        '-alt-color-black' => 'Schwarz',
        '-alt-color-white' => 'Weiß',
    ],
    'eval'      => ['tl_class' => 'clr w50', 'includeBlankOption' => true],
    'sql'       => "varchar(16) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_bgWidthRestriction'] = [
    'inputType'               => 'checkbox',
    'eval'                    => ['tl_class' => 'w50 m12'],
    'sql'                     => ['type' => 'boolean', 'default' => false]
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_minHeight'] = [
    'inputType' => 'select',
    'options'   => [
        '-mh-small'          => 'Schmal',
        '-mh-medium'         => 'Mittel',
        '-mh-large'          => 'Groß',
        '-mh-vh'        => 'Am Viewport orientiert',
        '-mh-ratio'        => 'Seitenverhältnis',
        '-mh-bgimage'        => 'an Hintergrundbild ausrichten',
        '-mh-custom' => 'Projektdefiniert',
    ],
    'eval'      => ['tl_class' => 'w50', 'includeBlankOption' => true, 'submitOnChange' =>true],
    'sql'       => "varchar(16) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_mh_ratio'] = [
    'inputType' => 'select',
    'options'   => [
        '-mh-ratio-21-9' => '21:9',
        '-mh-ratio-16-10' => '16:10',
        '-mh-ratio-16-9' => '16:9',
        '-mh-ratio-8-3' => '8:3',
        '-mh-ratio-5-4' => '5:4',
        '-mh-ratio-4-3' => '4:3',
        '-mh-ratio-3-2' => '3:2',
        '-mh-ratio-5-1' => '5:1',
        '-mh-ratio-4-1' => '4:1',
        '-mh-ratio-3-1' => '3:1',
        '-mh-ratio-2-1' => '2:1',
        '-mh-ratio-1-1' => '1:1',
    ],
    'eval'      => ['mandatory' => true, 'tl_class' => 'w50', 'includeBlankOption' => true],
    'sql'       => "varchar(16) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_mh_viewport'] = [
    'inputType' => 'select',
    'options'   => [
        '-mh-viewport-100' => '100%',
        '-mh-viewport-66' => '66%',
        '-mh-viewport-50' => '50%',
        '-mh-viewport-33' => '33%',
    ],
    'eval'      => ['mandatory' => true, 'tl_class' => 'w50', 'includeBlankOption' => true],
    'sql'       => "varchar(16) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_vAlign'] = [
    'inputType' => 'select',
    'options'   => [
        ''          => 'oben',
        '-va-center'         => 'mitte',
        '-va-bottom'         => 'unten',
        '-va-stretch'        => 'Höhe des Containers'
    ],
    'eval'      => ['tl_class' => 'clr w50'],
    'sql'       => "varchar(16) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_width'] = [
    'inputType' => 'select',
    'options' => [
        ''                      => 'Standard',
        '-width-small'          => 'Schmal',
        '-width-extended'       => 'Erweitert',
        '-width-default-left'   => 'Nach links versetzt',
        '-width-default-right'  => 'Nach rechts versetzt',
        '-width-extended-left'  => 'Nach links erweitert',
        '-width-extended-right' => 'Nach rechts erweitert',
        '-width-full'           => 'Gesamte Viewport-Breite',
    ],
    'eval'      => ['mandatory' => false, 'tl_class' => 'clr w50'],
    'sql'       => "varchar(24) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_widthText'] = [
    'inputType'               => 'checkbox',
    'eval'                    => ['tl_class' => 'w50 m12'],
    'sql'                     => ['type' => 'boolean', 'default' => false]
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_colorInvert'] = [
    'inputType'               => 'checkbox',
    'eval'                    => ['tl_class' => 'w50 m12'],
    'sql'                     => ['type' => 'boolean', 'default' => false]
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_bw_padding'] = [
    'inputType' => 'select',
    'options'   => [
        ''                       => '-',
        '-padding'               => 'Default',
        '-padding-medium'        => 'Medium',
        '-padding-large'         => 'Large',
        '-padding-top'           => 'Small Top',
        '-padding-top-medium'    => 'Medium Top',
        '-padding-top-large'     => 'Large Top',
        '-padding-bottom'        => 'Small Bottom',
        '-padding-bottom-medium' => 'Medium Bottom',
        '-padding-bottom-large'  => 'Large Bottom',
    ],
    'eval'      => ['mandatory' => false, 'tl_class' => 'w50'],
    'sql'       => "varchar(24) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_gpw_grid'] = [
    'exclude' => true,
    'inputType' => 'gridPosition',
    'eval'      => [
        'tl_class' => 'clr',
        'cols' => 12,
        'rows' => 7,
    ],
    'sql' => "text NULL",
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_gpw_tablet_grid'] = [
    'exclude' => true,
    'inputType' => 'gridPosition',
    'eval'      => [
        'tl_class' => 'clr',
        'cols' => 12,
        'rows' => 7,
    ],
    'sql' => "text NULL",
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_gpw_mobile_grid'] = [
    'exclude' => true,
    'inputType' => 'gridPosition',
    'eval'      => [
        'tl_class' => 'clr',
        'cols' => 12,
        'rows' => 7,
    ],
    'sql' => "text NULL",
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_gpw_desktop_vAlign'] = [
    'inputType' => 'select',
    'options'   => [
        ''          => 'oben',
        '-va-desktop-center'         => 'mitte',
        '-va-desktop-bottom'         => 'unten',
    ],
    'eval'      => ['tl_class' => 'clr w33'],
    'sql'       => "varchar(20) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_gpw_tablet_vAlign'] = [
    'inputType' => 'select',
    'options'   => [
        ''          => 'oben',
        '-va-tablet-center'         => 'mitte',
        '-va-tablet-bottom'         => 'unten',
    ],
    'eval'      => ['tl_class' => 'w33'],
    'sql'       => "varchar(20) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_gpw_mobile_vAlign'] = [
    'inputType' => 'select',
    'options'   => [
        ''          => 'oben',
        '-va-mobile-center'         => 'mitte',
        '-va-mobile-bottom'         => 'unten',
    ],
    'eval'      => ['tl_class' => 'w33'],
    'sql'       => "varchar(20) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_subline'] = [
    'inputType' => 'text',
    'eval'                    => array('maxlength'=>255, 'tl_class'=>'w50'),
    'sql'                     => "varchar(255) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_content']['fields']['vr_dt_size'] = [
    'inputType' => 'select',
    'options' => ['small', 'medium', 'large', 'h1', 'h2', 'h3'],
    'reference' => &$GLOBALS['TL_LANG']['tl_content']['vr_dt_size_options'],
    'eval' => [
        'includeBlankOption' => true,
        'tl_class' => 'w50'
    ],
    'sql' => "varchar(32) NOT NULL default ''"
];
$GLOBALS['TL_DCA']['tl_content']['fields']['vr_dt_plainText'] = [
    'inputType'               => 'textarea',
    'eval'                    => [
        'mandatory'=>true,
        'helpwizard'=>true
    ],
    'explanation'             => 'insertTags',
    'sql'                     => "mediumtext NULL"
];