feat: basic themes for event sites

This commit is contained in:
Björn Fromme
2026-03-16 12:00:56 +01:00
parent c7a27f1dc7
commit ee84690cd9
28 changed files with 1158 additions and 157 deletions
+29
View File
@@ -20,6 +20,8 @@ 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,
@@ -188,6 +190,33 @@ 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.
*