Display CMS: Footer-Verlauf, Format-Hinweise und Switch-Fixes.

Blendet den B2IN-Text-Verlauf ohne Footer aus, zeigt 9:16-Format-Badges in der Mediathek, normalisiert Modul-Booleans und korrigiert Flux-Switches im Dark Mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Kevin Adametz 2026-06-18 08:27:44 +00:00
parent 6c2da9bdac
commit 7491d20d39
14 changed files with 366 additions and 10 deletions

View file

@ -6,6 +6,14 @@ use App\Enums\DisplayVersionType;
class DisplayModuleSettings
{
/** @var list<string> */
private const B2IN_BOOLEAN_KEYS = [
'show_logo',
'show_claim',
'show_footer',
'display_active',
];
/**
* @return array<string, mixed>
*/
@ -55,6 +63,44 @@ class DisplayModuleSettings
*/
public static function merge(DisplayVersionType|string $type, ?array $settings): array
{
return array_replace_recursive(self::defaults($type), $settings ?? []);
$merged = array_replace_recursive(self::defaults($type), $settings ?? []);
$typeValue = $type instanceof DisplayVersionType ? $type->value : $type;
if ($typeValue === DisplayVersionType::B2in->value) {
return self::normalizeB2inBooleans($merged);
}
if ($typeValue === DisplayVersionType::Offers->value && array_key_exists('loop', $merged)) {
$merged['loop'] = self::toBool($merged['loop']);
}
return $merged;
}
/**
* @param array<string, mixed> $settings
* @return array<string, mixed>
*/
private static function normalizeB2inBooleans(array $settings): array
{
foreach (self::B2IN_BOOLEAN_KEYS as $key) {
if (array_key_exists($key, $settings)) {
$settings[$key] = self::toBool($settings[$key]);
}
}
return $settings;
}
private static function toBool(mixed $value): bool
{
if (is_bool($value)) {
return $value;
}
$filtered = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
return $filtered ?? (bool) $value;
}
}