fix(map): simplify filters and restore style toggle behavior

This commit is contained in:
Jürgen Mummert
2026-02-26 18:26:20 +01:00
parent 40aaa747d9
commit 621ce8dc8b
6 changed files with 141 additions and 138 deletions
@@ -35,7 +35,7 @@ class EventMapController extends AbstractFrontendModuleController
$showEvents = '1' === (string) ($model->mapShowEvents ?? '');
$centerMode = (string) ($model->mapCenterMode ?? self::DEFAULT_CENTER_MODE);
$eventColor = $this->normalizeHexColor((string) ($model->mapEventColor ?? self::DEFAULT_EVENT_COLOR));
$organizationColorScheme = trim((string) ($model->mapOrganizationColorScheme ?? ''));
$organizationColor = $this->normalizeHexColor((string) ($model->mapOrganizationColor ?? $eventColor), $eventColor);
if (!in_array($centerMode, ['markers', 'custom'], true)) {
$centerMode = self::DEFAULT_CENTER_MODE;
@@ -48,7 +48,7 @@ class EventMapController extends AbstractFrontendModuleController
$template->set('mapStyleUrl', self::MAP_STYLE_URL);
$template->set('mapCenterMode', $centerMode);
$template->set('mapEventColor', $eventColor);
$template->set('mapOrganizationColorScheme', $organizationColorScheme);
$template->set('mapOrganizationColor', $organizationColor);
$template->set('mapCenterLat', trim((string) ($model->mapCenterLat ?? '')));
$template->set('mapCenterLng', trim((string) ($model->mapCenterLng ?? '')));
$template->set('mapCenterZoom', (int) ($model->mapCenterZoom ?? 12));
@@ -61,7 +61,7 @@ class EventMapController extends AbstractFrontendModuleController
return $template->getResponse();
}
private function normalizeHexColor(string $value): string
private function normalizeHexColor(string $value, string $fallback = self::DEFAULT_EVENT_COLOR): string
{
$normalized = strtoupper(trim($value));
@@ -91,6 +91,6 @@ class EventMapController extends AbstractFrontendModuleController
);
}
return self::DEFAULT_EVENT_COLOR;
return $fallback;
}
}