feat: domain-based theme-detection

This commit is contained in:
Björn Fromme committed 2026-03-16 12:02:59 +01:00
1 parent e24403949c
commit 11ab98b3d8
9 files changed
+189 -38

No files matched your search

-29
View File
@@ -22,8 +22,6 @@ class BookingService
public const BOOKING_EDIT_KEY = 'booking_edit';
public const RETURN_URL_KEY = 'booking_return_url';
public const DEFAULT_RETURN_URL = 'https://www.ep-reisen.de';
public const THEME_KEY = 'booking_theme';
public const DEFAULT_THEME = 'base';
public function __construct(
private readonly TravelDataService $travelDataService,
@@ -195,33 +193,6 @@ class BookingService
return $request->getSession()->get(self::RETURN_URL_KEY, self::DEFAULT_RETURN_URL);
}
/**
* Stores the theme identifier in the session.
*
* Sanitizes the theme value to allow only alphanumeric characters and hyphens.
* Falls back to the default theme if empty or invalid.
*/
public function storeTheme(Request $request, string $theme): void
{
$sanitized = preg_replace('/[^a-zA-Z0-9-]/', '', $theme);
if ('' === $sanitized) {
$sanitized = self::DEFAULT_THEME;
}
$request->getSession()->set(self::THEME_KEY, $sanitized);
}
/**
* Retrieves the theme identifier from the session.
*
* Returns the default theme if not set in session.
*/
public function getTheme(Request $request): string
{
return $request->getSession()->get(self::THEME_KEY, self::DEFAULT_THEME);
}
/**
* Creates a fresh booking session with the provided travel parameters.
*