diff --git a/contao/dca/tl_module.php b/contao/dca/tl_module.php index 98d450a..f06f528 100644 --- a/contao/dca/tl_module.php +++ b/contao/dca/tl_module.php @@ -9,7 +9,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,eventListDomId;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID'; -$GLOBALS['TL_DCA']['tl_module']['palettes']['eventmanager_map'] = '{title_legend},name,headline,type;{eventmanager_legend},mapShowOrganizations,organizationTypeTags,mapShowExternalOrganizations,mapShowEvents,mapInitialDisplay,mapEventColor,mapOrganizationColor,mapCenterMode;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID'; +$GLOBALS['TL_DCA']['tl_module']['palettes']['eventmanager_map'] = '{title_legend},name,headline,type;{eventmanager_legend},mapShowOrganizations,organizationTypeTags,mapShowExternalOrganizations,mapShowEvents,mapInitialDisplay,mapEventColor,mapOrganizationColor,mapPitch,mapCenterMode;{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'; @@ -162,7 +162,7 @@ $GLOBALS['TL_DCA']['tl_module']['fields']['eventListDomId'] = [ $GLOBALS['TL_DCA']['tl_module']['palettes']['__selector__'][] = 'mapCenterMode'; $GLOBALS['TL_DCA']['tl_module']['palettes']['__selector__'][] = 'mapInitialDisplay'; -$GLOBALS['TL_DCA']['tl_module']['subpalettes']['mapCenterMode_custom'] = 'mapCenterLat,mapCenterLng,mapCenterZoom,mapPitch'; +$GLOBALS['TL_DCA']['tl_module']['subpalettes']['mapCenterMode_custom'] = 'mapCenterLat,mapCenterLng,mapCenterZoom'; $GLOBALS['TL_DCA']['tl_module']['subpalettes']['mapInitialDisplay_organization_tag'] = 'mapInitialOrganizationTagId'; $GLOBALS['TL_DCA']['tl_module']['fields']['mapShowOrganizations'] = [ diff --git a/src/Service/MapModuleDataProvider.php b/src/Service/MapModuleDataProvider.php index e69a242..372fb03 100644 --- a/src/Service/MapModuleDataProvider.php +++ b/src/Service/MapModuleDataProvider.php @@ -216,23 +216,36 @@ class MapModuleDataProvider return []; } + $tagColumns = $this->getColumnMap('tl_tags'); + $tagLabelColumn = isset($tagColumns['title']) ? 'title' : (isset($tagColumns['tag']) ? 'tag' : null); + + if (null === $tagLabelColumn) { + return []; + } + $rows = $this->connection->executeQuery( - 'SELECT r.pid AS organization_id, r.tag_id, t.tag AS label + sprintf( + 'SELECT r.pid AS organization_id, r.tag_id, t.%s AS label FROM tl_tags_rel r INNER JOIN tl_tags t ON t.id = r.tag_id WHERE r.ptable = ? AND r.field = ? AND r.pid IN (?) ORDER BY r.pid ASC, r.tag_id ASC', + $tagLabelColumn, + ), ['tl_organization', 'tags', $organizationIds], [ParameterType::STRING, ParameterType::STRING, ArrayParameterType::INTEGER], )->fetchAllAssociative(); if ([] === $rows) { $rows = $this->connection->executeQuery( - 'SELECT r.pid AS organization_id, r.tag_id, t.tag AS label + sprintf( + 'SELECT r.pid AS organization_id, r.tag_id, t.%s AS label FROM tl_tags_rel r INNER JOIN tl_tags t ON t.id = r.tag_id WHERE r.ptable = ? AND r.pid IN (?) ORDER BY r.pid ASC, r.tag_id ASC', + $tagLabelColumn, + ), ['tl_organization', $organizationIds], [ParameterType::STRING, ArrayParameterType::INTEGER], )->fetchAllAssociative(); @@ -246,13 +259,16 @@ class MapModuleDataProvider $tagId = (int) ($row['tag_id'] ?? 0); $label = trim((string) ($row['label'] ?? '')); - if ($organizationId <= 0 || $tagId <= 0 || '' === $label || isset($seen[$organizationId][$tagId])) { + if ($organizationId <= 0 || $tagId <= 0 || isset($seen[$organizationId][$tagId])) { continue; } $seen[$organizationId][$tagId] = true; $map[$organizationId]['ids'][] = (string) $tagId; - $map[$organizationId]['labels'][] = $label; + + if ('' !== $label) { + $map[$organizationId]['labels'][] = $label; + } } foreach ($map as $organizationId => $tagData) {