73 lines
2.9 KiB
PHP
73 lines
2.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Contao\Database;
|
|
use Contao\StringUtil;
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['news_submission'] = '{title_legend},name,headline,type;{news_submission_legend},author,newsArchive,uploadFolder,thankYouPage,allowedTags;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['event_submission_confirmation'] = '{title_legend},name,headline,type;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['author'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['author'],
|
|
'exclude' => true,
|
|
'inputType' => 'select',
|
|
'foreignKey' => 'tl_user.name',
|
|
'eval' => ['mandatory' => true, 'chosen' => true, 'includeBlankOption' => true, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
|
|
'relation' => ['type' => 'hasOne', 'load' => 'lazy'],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['newsArchive'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['newsArchive'],
|
|
'exclude' => true,
|
|
'inputType' => 'select',
|
|
'foreignKey' => 'tl_news_archive.title',
|
|
'eval' => ['mandatory' => true, 'chosen' => true, 'includeBlankOption' => true, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
|
|
'relation' => ['type' => 'hasOne', 'load' => 'lazy'],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['uploadFolder'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['uploadFolder'],
|
|
'exclude' => true,
|
|
'inputType' => 'fileTree',
|
|
'eval' => ['fieldType' => 'radio', 'files' => false, 'mandatory' => true, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'binary', 'length' => 16, 'notnull' => false],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['thankYouPage'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['thankYouPage'],
|
|
'exclude' => true,
|
|
'inputType' => 'pageTree',
|
|
'eval' => ['fieldType' => 'radio', 'mandatory' => true, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['allowedTags'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['allowedTags'],
|
|
'exclude' => true,
|
|
'inputType' => 'checkbox',
|
|
'options_callback' => static function (): array {
|
|
$rows = Database::getInstance()
|
|
->prepare("SELECT id, tag FROM tl_tags WHERE invisible='' ORDER BY tag ASC")
|
|
->execute()
|
|
->fetchAllAssoc();
|
|
|
|
$options = [];
|
|
|
|
foreach ($rows as $row) {
|
|
$options[(int) $row['id']] = (string) $row['tag'];
|
|
}
|
|
|
|
return $options;
|
|
},
|
|
'eval' => ['multiple' => true, 'tl_class' => 'clr'],
|
|
'sql' => ['type' => 'blob', 'notnull' => false],
|
|
'save_callback' => [
|
|
static function ($value): array {
|
|
return array_values(array_unique(array_map('intval', StringUtil::deserialize($value, true))));
|
|
},
|
|
],
|
|
];
|