122 lines
5.3 KiB
PHP
122 lines
5.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Contao\Database;
|
|
use Contao\StringUtil;
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['member_organizations'] = '{title_legend},name,headline,type;{eventmanager_legend},editPage;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['member_events'] = '{title_legend},name,headline,type;{eventmanager_legend},editPage;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['organization_edit'] = '{title_legend},name,headline,type;{eventmanager_legend},listPage,logoFolder,organizationTypeTags;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['event_edit'] = '{title_legend},name,headline,type;{eventmanager_legend},listPage,eventFolder,termsPage,frontendAuthorId,frontendArchiveId,eventTypeTags;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['editPage'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['editPage'],
|
|
'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']['listPage'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['listPage'],
|
|
'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']['logoFolder'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['logoFolder'],
|
|
'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']['eventFolder'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['eventFolder'],
|
|
'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']['termsPage'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['termsPage'],
|
|
'exclude' => true,
|
|
'inputType' => 'pageTree',
|
|
'eval' => ['fieldType' => 'radio', 'mandatory' => false, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['frontendAuthorId'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['frontendAuthorId'],
|
|
'exclude' => true,
|
|
'inputType' => 'text',
|
|
'eval' => ['mandatory' => true, 'rgxp' => 'digit', 'maxlength' => 10, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['frontendArchiveId'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['frontendArchiveId'],
|
|
'exclude' => true,
|
|
'inputType' => 'text',
|
|
'eval' => ['mandatory' => true, 'rgxp' => 'digit', 'maxlength' => 10, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['organizationTypeTags'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['organizationTypeTags'],
|
|
'exclude' => true,
|
|
'inputType' => 'checkbox',
|
|
'options_callback' => static function () {
|
|
$rows = Database::getInstance()
|
|
->prepare('SELECT DISTINCT t.id, t.tag FROM tl_tags t LEFT JOIN tl_tags_rel r ON r.tag_id=t.id AND r.ptable=? AND r.field=? ORDER BY t.tag ASC')
|
|
->execute('tl_organization', 'tags')
|
|
->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))));
|
|
},
|
|
],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['eventTypeTags'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['eventTypeTags'],
|
|
'exclude' => true,
|
|
'inputType' => 'checkbox',
|
|
'options_callback' => static function () {
|
|
$rows = Database::getInstance()
|
|
->prepare('SELECT DISTINCT t.id, t.tag FROM tl_tags t LEFT JOIN tl_tags_rel r ON r.tag_id=t.id AND r.ptable=? AND r.field=? ORDER BY t.tag ASC')
|
|
->execute('tl_calendar_events', 'tags')
|
|
->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))));
|
|
},
|
|
],
|
|
];
|