Add configurable target event list ID for event filter module
This commit is contained in:
@@ -7,7 +7,7 @@ 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']['event_filter'] = '{title_legend},name,headline,type;{eventmanager_legend},cal_calendar;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
|
||||
$GLOBALS['TL_DCA']['tl_module']['palettes']['event_filter'] = '{title_legend},name,headline,type;{eventmanager_legend},cal_calendar,eventListDomId;{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';
|
||||
|
||||
@@ -120,3 +120,40 @@ $GLOBALS['TL_DCA']['tl_module']['fields']['eventTypeTags'] = [
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_module']['fields']['eventListDomId'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_module']['eventListDomId'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'select',
|
||||
'options_callback' => static function (): array {
|
||||
$rows = Database::getInstance()
|
||||
->prepare('SELECT id, name, cssID FROM tl_module WHERE type=? ORDER BY name ASC, id ASC')
|
||||
->execute('eventlist')
|
||||
->fetchAllAssoc();
|
||||
|
||||
$options = [];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$moduleId = (int) ($row['id'] ?? 0);
|
||||
|
||||
if ($moduleId <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$cssId = StringUtil::deserialize($row['cssID'] ?? null, true);
|
||||
$domId = trim((string) ($cssId[0] ?? ''));
|
||||
$domId = '' !== $domId ? $domId : sprintf('mod_eventlist_%d', $moduleId);
|
||||
$moduleName = trim((string) ($row['name'] ?? ''));
|
||||
|
||||
if ('' === $moduleName) {
|
||||
$moduleName = sprintf('Eventliste %d', $moduleId);
|
||||
}
|
||||
|
||||
$options[$domId] = sprintf('%s [%s]', $moduleName, $domId);
|
||||
}
|
||||
|
||||
return $options;
|
||||
},
|
||||
'eval' => ['includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'],
|
||||
'sql' => ['type' => 'string', 'length' => 128, 'default' => ''],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user