Refactor type handling to contao-tags and add module tag filters

This commit is contained in:
Jürgen Mummert
2026-02-21 22:23:53 +01:00
parent a6440c74a2
commit f93ed0d0c6
18 changed files with 413 additions and 63 deletions
+10 -6
View File
@@ -22,7 +22,7 @@ $GLOBALS['TL_DCA']['tl_calendar_events']['config']['onload_callback'][] = static
PaletteManipulator::create()
->addLegend('organization_legend', 'details_legend', PaletteManipulator::POSITION_AFTER)
->addField(['location_id', 'type', 'organizations'], 'organization_legend', PaletteManipulator::POSITION_APPEND)
->addField(['location_id', 'tags', 'organizations'], 'organization_legend', PaletteManipulator::POSITION_APPEND)
->applyToPalette((string) $paletteName, 'tl_calendar_events');
PaletteManipulator::create()
@@ -71,14 +71,18 @@ $GLOBALS['TL_DCA']['tl_calendar_events']['fields']['location_id'] = [
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
];
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['type'] = [
'label' => &$GLOBALS['TL_LANG']['tl_calendar_events']['type'],
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['tags'] = [
'label' => &$GLOBALS['TL_LANG']['tl_calendar_events']['tags'],
'exclude' => true,
'filter' => true,
'inputType' => 'select',
'options' => ['accommodation', 'shopping', 'culture'],
'reference' => &$GLOBALS['TL_LANG']['tl_calendar_events']['type_options'],
'eval' => ['multiple' => true, 'chosen' => true, 'includeBlankOption' => false, 'tl_class' => 'w50'],
'foreignKey' => 'tl_tags.tag',
'options_callback' => ['numero2_tags.listener.data_container.tags', 'getTagOptions'],
'load_callback' => [['numero2_tags.listener.data_container.tags', 'loadTags']],
'save_callback' => [['numero2_tags.listener.data_container.tags', 'saveTags']],
'eval' => ['multiple' => true, 'size' => 8, 'tl_class' => 'w50 tags', 'chosen' => true, 'groupTagsByField' => true, 'tagGroup' => 'event_type'],
'sql' => ['type' => 'blob', 'notnull' => false],
'relation' => ['type' => 'hasMany', 'load' => 'eager'],
];
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['organizations'] = [