PHP-Code:
<?php
// contao/dca/tl_news.php
use Contao\CoreBundle\DataContainer\PaletteManipulator;
$GLOBALS['TL_DCA']['tl_news']['fields']['addGallery'] = [
'label' => ['Galerie', 'Bitte wählen Sie eine oder mehr Dateien oder Ordner aus der Dateiübersicht. Wenn Sie einen Ordner auswählen, werden die darin enthaltenen Dateien automatisch eingefügt.'],
'inputType' => 'fileTree',
'eval' => [
'tl_class' => 'w50',
'isGallery' => true,
'multiple' => true,
'fieldType' => 'checkbox',
'orderField' => 'addOrderSRC',
'files' => true,
'extensions' => \Config::get('validImageTypes'),
],
'sql' => ['type' => 'blob', 'notnull' => false],
];
$GLOBALS['TL_DCA']['tl_news']['fields']['addOrderSRC'] = [
'label' => &$GLOBALS['TL_LANG']['MSC']['sortOrder'],
'sql' => ['type' => 'blob', 'notnull' => false],
];
$GLOBALS['TL_DCA']['tl_news']['fields']['addSize'] = [
'label' => &$GLOBALS['TL_LANG']['MSC']['imgSize'],
'exclude' => true,
'inputType' => 'imageSize',
'options' => \System::getImageSizes(),
'reference' => &$GLOBALS['TL_LANG']['MSC'],
'eval' => [
'tl_class'=>'clr w50',
'rgxp'=>'natural',
'includeBlankOption'=>true,
'nospace'=>true,
'helpwizard'=>true,
],
'options_callback' => static function ()
{
return System::getContainer()->get('contao.image.image_sizes')->getOptionsForUser(BackendUser::getInstance());
},
'sql' => "varchar(128) COLLATE ascii_bin NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_news']['fields']['addFullsize'] = [
'label' => &$GLOBALS['TL_LANG']['tl_content']['fullsize'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => [
'tl_class' => 'w50 m12',
],
'sql' => "char(1) COLLATE ascii_bin NOT NULL default ''",
];
PaletteManipulator::create()
->addLegend('media_legend','enclosure_legend', PaletteManipulator::POSITION_BEFORE)
->addField('addGallery', 'media_legend', PaletteManipulator::POSITION_APPEND)
->addField('addOrderSRC', 'media_legend', PaletteManipulator::POSITION_APPEND)
->addField('addSize', 'media_legend', PaletteManipulator::POSITION_APPEND)
->addField('addFullSize', 'media_legend', PaletteManipulator::POSITION_APPEND)
->applyToPalette('default', 'tl_news')
->applyToPalette('internal', 'tl_news')
->applyToPalette('article', 'tl_news')
->applyToPalette('external', 'tl_news')
;
weitere Frage dazu: