system/modules/pct_theme_settings/dca/tl_article.php line 77

Open in your IDE?
  1. <?php
  2. /**
  3.  * Contao Open Source CMS
  4.  *
  5.  * Copyright (C) 2005-2013 Leo Feyer
  6.  *
  7.  * @copyright   Tim Gatzky 2019
  8.  * @author      Tim Gatzky <info@tim-gatzky.de>
  9.  * @package     pct_theme_settings
  10.  * @link        http://contao.org
  11.  */
  12. /**
  13.  * Load language files
  14.  */
  15. \Contao\System::loadLanguageFile('tl_style');
  16. \Contao\System::loadLanguageFile('tl_content');
  17. \Contao\System::loadLanguageFile('dca_theme_settings');
  18. /**
  19.  * Config
  20.  */
  21. $GLOBALS['TL_DCA']['tl_article']['config']['onload_callback'][] = array('PCT\ThemeSettings\Backend\TableArticle''filterPagesOnLockdown');
  22. /**
  23.  * Selector
  24.  */
  25. $GLOBALS['TL_DCA']['tl_article']['palettes']['__selector__'][] = 'background';
  26. $GLOBALS['TL_DCA']['tl_article']['palettes']['__selector__'][] = 'overlay';
  27. /**
  28.  * Subpalettes
  29.  */
  30. $GLOBALS['TL_DCA']['tl_article']['subpalettes']['background'] = 'bgcolor,bgcolor_css,bgimage,size,bgposition,bgrepeat,bgsize,fullscreen,offsetCssID';
  31. $GLOBALS['TL_DCA']['tl_article']['subpalettes']['overlay'] = 'ol_bgcolor_css,ol_position,ol_width,ol_height,ol_opacity';
  32. /**
  33.  * Palettes
  34.  */
  35. $GLOBALS['TL_DCA']['tl_article']['palettes']['default'] = \str_replace('customTpl''customTpl;{theme_settings:hide},layout_css,color_css,padding_t,padding_b,background,overlay'$GLOBALS['TL_DCA']['tl_article']['palettes']['default']);
  36. $GLOBALS['TL_DCA']['tl_article']['palettes']['default'] = \str_replace('stop''stop,visibility_css'$GLOBALS['TL_DCA']['tl_article']['palettes']['default']);
  37. /**
  38.  * Fields
  39.  */
  40. \array_insert($GLOBALS['TL_DCA']['tl_article']['fields'], 0, array
  41. (
  42.     // background
  43.     'background'    => array
  44.     (
  45.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['background'],
  46.         'exclude'                 => true,
  47.         'inputType'               => 'checkbox',
  48.         'eval'                    => array('submitOnChange'=>true,'tl_class'=>'clr'),
  49.         'sql'                     => "char(1) NOT NULL default ''"
  50.     ),
  51.     'bgcolor'   => array
  52.     (
  53.         'label'                   => &$GLOBALS['TL_LANG']['tl_style']['bgcolor'],
  54.         'exclude'                 => true,
  55.         'inputType'               => 'text',
  56.         'eval'                    => array('maxlength'=>6'multiple'=>true'size'=>2'colorpicker'=>true'isHexColor'=>true'decodeEntities'=>true'tl_class'=>'clr w50 wizard'),
  57.         'sql'                     => "varchar(64) NOT NULL default ''"
  58.     ),
  59.     'bgimage'   => array
  60.     (
  61.         'label'                   => &$GLOBALS['TL_LANG']['tl_style']['bgimage'],
  62.         'exclude'                 => true,
  63.         'inputType'               => 'text',
  64.         'eval'                    => array('tl_class'=>'w50 wizard'),
  65.         'eval'                    => array('filesOnly'=>true'extensions'=>\Contao\Config::get('validImageTypes'), 'fieldType'=>'radio','dcaPicker'=> array('do'=>'files''context'=>'file''icon'=>'pickfile.svg''fieldType'=>'radio''filesOnly'=>true'extensions'=>\Contao\Config::get('validImageTypes')), 'tl_class'=>'w50 wizard'),
  66.         'save_callback'              => array
  67.         (
  68.             array('PCT\ThemeSettings\Backend\TableArticle','saveUuidFromPath'),
  69.         ),
  70.         'load_callback'              => array
  71.         (
  72.             array('PCT\ThemeSettings\Backend\TableArticle','loadPathFromUuid'),
  73.         ),
  74.         'sql'                     => "varchar(255) NOT NULL default ''"
  75.     ),
  76.     'bgposition'    => array
  77.     (
  78.         'label'                   => &$GLOBALS['TL_LANG']['tl_style']['bgposition'],
  79.         'exclude'                 => true,
  80.         'inputType'               => 'select',
  81.         'options'                 => $GLOBALS['PCT_THEME_SETTINGS']['bgposition_classes'],
  82.         'reference'               => $GLOBALS['TL_LANG']['dca_theme_settings']['values'],
  83.         'eval'                    => array('includeBlankOption'=>true'tl_class'=>'w50','chosen'=>true),
  84.         'sql'                     => "varchar(32) NOT NULL default ''"
  85.     ),
  86.     'bgrepeat' => array
  87.     (
  88.         'label'                   => &$GLOBALS['TL_LANG']['tl_style']['bgrepeat'],
  89.         'exclude'                 => true,
  90.         'inputType'               => 'select',
  91.         'options'                 => array('repeat''repeat-x''repeat-y''no-repeat'),
  92.         'eval'                    => array('includeBlankOption'=>true'tl_class'=>'w50'),
  93.         'sql'                     => "varchar(32) NOT NULL default ''"
  94.     ),
  95.     'bgsize' => array
  96.     (
  97.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['bgsize'],
  98.         'exclude'                 => true,
  99.         'inputType'               => 'text',
  100.         'eval'                    => array('tl_class'=>'w50'),
  101.         'sql'                     => "varchar(16) NOT NULL default ''"
  102.     ),
  103.     'size' => array
  104.     (
  105.         'label'                   => &$GLOBALS['TL_LANG']['tl_content']['size'],
  106.         'exclude'                 => true,
  107.         'inputType'               => 'imageSize',
  108.         'reference'               => &$GLOBALS['TL_LANG']['MSC'],
  109.         'eval'                    => array('rgxp'=>'natural''includeBlankOption'=>true'nospace'=>true'helpwizard'=>true'tl_class'=>'w50'),
  110.         'options_callback' => function ()
  111.         {
  112.             return \Contao\System::getContainer()->get('contao.image.image_sizes')->getOptionsForUser(\Contao\BackendUser::getInstance());
  113.         },
  114.         'sql'                     => "varchar(64) NOT NULL default ''"
  115.     ),
  116.     'bgcolor_css' => array
  117.     (
  118.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['bgcolor_css'],
  119.         'exclude'                 => true,
  120.         'inputType'               => 'select',
  121.         'options'                 => $GLOBALS['PCT_THEME_SETTINGS']['bgcolor_classes'],
  122.         'reference'               => $GLOBALS['TL_LANG']['dca_theme_settings']['values'],
  123.         'eval'                    => array('includeBlankOption'=>true,'tl_class'=>'w50'),
  124.         'sql'                     => "varchar(32) NOT NULL default ''"
  125.     ),
  126.     // overlay
  127.     'overlay'   => array
  128.     (
  129.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['overlay'],
  130.         'exclude'                 => true,
  131.         'inputType'               => 'checkbox',
  132.         'eval'                    => array('submitOnChange'=>true,'tl_class'=>'clr'),
  133.         'sql'                     => "char(1) NOT NULL default ''"
  134.     ),
  135.     'ol_position' => array
  136.     (
  137.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['ol_position'],
  138.         'exclude'                 => true,
  139.         'inputType'               => 'select',
  140.         'options'                 => $GLOBALS['PCT_THEME_SETTINGS']['ol_position_classes'],
  141.         'reference'               => $GLOBALS['TL_LANG']['dca_theme_settings']['values'],
  142.         'eval'                    => array('includeBlankOption'=>false,'tl_class'=>'w50','chosen'=>true),
  143.         'sql'                     => "varchar(16) NOT NULL default ''"
  144.     ),
  145.     'ol_width' => array
  146.     (
  147.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['ol_width'],
  148.         'exclude'                 => true,
  149.         'inputType'               => 'select',
  150.         'options'                 => $GLOBALS['PCT_THEME_SETTINGS']['ol_width_classes'],
  151.         'reference'               => $GLOBALS['TL_LANG']['dca_theme_settings']['values'],
  152.         'eval'                    => array('tl_class'=>'w50','chosen'=>true),
  153.         'sql'                     => "varchar(16) NOT NULL default ''"
  154.     ),
  155.     'ol_height' => array
  156.     (
  157.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['ol_height'],
  158.         'exclude'                 => true,
  159.         'inputType'               => 'inputUnit',
  160.         'options'                 => array('px','pct'),
  161.         'reference'               => $GLOBALS['TL_LANG']['dca_theme_settings']['units'],
  162.         'eval'                    => array('tl_class'=>'w50'),
  163.         'sql'                     => "varchar(128) NOT NULL default ''"
  164.     ),
  165.     'ol_bgcolor_css' => array
  166.     (
  167.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['ol_bgcolor_css'],
  168.         'exclude'                 => true,
  169.         'inputType'               => 'select',
  170.         'options'                 => $GLOBALS['PCT_THEME_SETTINGS']['ol_bgcolor_css_classes'],
  171.         'reference'               => $GLOBALS['TL_LANG']['dca_theme_settings']['values'],
  172.         'eval'                    => array('includeBlankOption'=>true,'tl_class'=>'w50'),
  173.         'sql'                     => "varchar(16) NOT NULL default ''"
  174.     ),
  175.     'ol_opacity' => array
  176.     (
  177.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['ol_opacity'],
  178.         'exclude'                 => true,
  179.         'inputType'               => 'select',
  180.         'options'                 => $GLOBALS['PCT_THEME_SETTINGS']['ol_opacity_classes'],
  181.         'reference'               => $GLOBALS['TL_LANG']['dca_theme_settings']['values'],
  182.         'eval'                    => array('includeBlankOption'=>true,'tl_class'=>'w50'),
  183.         'sql'                     => "varchar(16) NOT NULL default ''"
  184.     ),
  185.     'fullscreen'    => array
  186.     (
  187.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['fullscreen'],
  188.         'exclude'                 => true,
  189.         'inputType'               => 'checkbox',
  190.         'eval'                    => array('tl_class'=>'clr m12 w50'),
  191.         'sql'                     => "char(1) NOT NULL default ''"
  192.     ),
  193.     'offsetCssID'    => array
  194.     (
  195.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['offsetCssID'],
  196.         'exclude'                 => true,
  197.         'inputType'               => 'text',
  198.         'eval'                    => array('tl_class'=>'w50'),
  199.         'sql'                     => "varchar(196) NOT NULL default ''"
  200.     ),
  201.     'layout_css'    => array
  202.     (
  203.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['layout_css'],
  204.         'exclude'                 => true,
  205.         'inputType'               => 'select',
  206.         'options'                 => $GLOBALS['PCT_THEME_SETTINGS']['width_classes'],
  207.         'reference'               => $GLOBALS['TL_LANG']['dca_theme_settings']['values'],
  208.         'eval'                    => array('includeBlankOption'=>false'tl_class'=>'w50'),
  209.         'sql'                     => "varchar(32) NOT NULL default ''"
  210.     ),
  211.     'color_css'    => array
  212.     (
  213.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['color_css'],
  214.         'exclude'                 => true,
  215.         'inputType'               => 'select',
  216.         'options'                 => $GLOBALS['PCT_THEME_SETTINGS']['color_classes::article'],
  217.         'reference'               => $GLOBALS['TL_LANG']['dca_theme_settings']['color_css'],
  218.         'eval'                    => array('includeBlankOption'=>true'tl_class'=>'w50'),
  219.         'sql'                     => "varchar(32) NOT NULL default ''"
  220.     ),
  221.     // general
  222.     'padding_t' => array
  223.     (
  224.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['padding_t'],
  225.         'exclude'                 => true,
  226.         'inputType'               => 'select',
  227.         'options'                 => $GLOBALS['PCT_THEME_SETTINGS']['padding_top_classes'],
  228.         'reference'               => $GLOBALS['TL_LANG']['dca_theme_settings']['values'],
  229.         'eval'                    => array('includeBlankOption'=>false'tl_class'=>'clr w50','chosen'=>true),
  230.         'sql'                     => "varchar(16) NOT NULL default ''"
  231.     ),
  232.     'padding_b' => array
  233.     (
  234.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['padding_b'],
  235.         'exclude'                 => true,
  236.         'inputType'               => 'select',
  237.         'options'                 => $GLOBALS['PCT_THEME_SETTINGS']['padding_bottom_classes'],
  238.         'reference'               => $GLOBALS['TL_LANG']['dca_theme_settings']['values'],
  239.         'eval'                    => array('includeBlankOption'=>false,'tl_class'=>'w50','chosen'=>true),
  240.         'sql'                     => "varchar(16) NOT NULL default ''"
  241.     ),
  242.     'visibility_css'    => array
  243.     (
  244.         'label'                   => &$GLOBALS['TL_LANG']['dca_theme_settings']['visibility_css'],
  245.         'exclude'                 => true,
  246.         'inputType'               => 'select',
  247.         'options'                 => $GLOBALS['PCT_THEME_SETTINGS']['visibility_classes'],
  248.         'reference'               => $GLOBALS['TL_LANG']['dca_theme_settings']['visibility_css'],
  249.         'eval'                    => array('includeBlankOption'=>true'tl_class'=>'w50'),
  250.         'sql'                     => "varchar(32) NOT NULL default ''"
  251.     ),
  252. ));
  253. if ( \version_compare(VERSION'4.13''>=') )
  254. {
  255.     $GLOBALS['TL_DCA']['tl_article']['fields']['size']['label'] = &$GLOBALS['TL_LANG']['MSC']['imgSize'];
  256. }