Führe Abschnitte mit Raster, gemeinsames Designsystem und globales Website-Gerüst ein.
CI Feature / test (push) Failing after 20s
CI Feature / test (push) Failing after 20s
- Seite → Abschnitte → Plätze → Widgets: sechs Raster mit höchstens vier Einheiten, Hintergrund, Breite, Abstand und Trenner als Aufzählungswerte; je Platz ein Widget aus dem bestehenden Register. Neue Spalte page_revisions.sections (ergänzend); blocks erhält weiterhin alle Widgets in Lesereihenfolge als Rollback-Fassung. - Widgets erhalten Mindest- und Vorzugsbreite; Darstellung über Container-Abfragen. - Editor: Abschnitts-Repeater mit grafischer Rasterauswahl, Plätzen im Rasterverhältnis, breiter Arbeitsfläche, kompakten Vorschauen ohne Bildlaufleiste, Meldungen mit Abschnitt und Platz; Rasterwechsel entfernt nie ein Widget. Seite duplizieren. - Designsystem: Marken- und Bedeutungs-Tokens (vorläufig), gemeinsame Grundkomponenten, Nunito/Source Sans 3 lokal; Mitgliederbereich nutzt dieselben Tokens und die Wortmarke. - Kopfzeile, mobile Navigation, Untermenü (parent_id, ergänzend), Fußbereichsgruppen, vorbereiteter Warenkorbzugang (abgeschaltet). Öffentliche Seiten gleich für alle Besucher. - cms:revert-published als Wiederherstellungsweg vor einem Code-Rollback. Die Editor-Tests der ersten Iteration sind bewusst auf den neuen Formularzustand (sections statt blocks) umgestellt; ihre Prüfungen gelten unverändert für die Widgets. Der Vorschautest erwartet keine anmeldeabhängige Kopfzeile mehr (ADR-32). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
db4bd30319
commit
480d55989b
57 files changed
+4730
-818
No files matched your search
@@ -45,6 +45,10 @@ public function register(WidgetType $type): void
|
||||
throw new InvalidArgumentException("Widget „{$key}“ braucht eine Schemaversion ab 1.");
|
||||
}
|
||||
|
||||
if ($type->minUnits() < 1 || $type->minUnits() > 4 || $type->preferredUnits() < $type->minUnits() || $type->preferredUnits() > 4) {
|
||||
throw new InvalidArgumentException("Widget „{$key}“ braucht eine Mindest- und Vorzugsbreite zwischen 1 und 4 Rastereinheiten.");
|
||||
}
|
||||
|
||||
if ($type->variants() === []) {
|
||||
throw new InvalidArgumentException("Widget „{$key}“ braucht mindestens eine Darstellungsvariante.");
|
||||
}
|
||||
@@ -137,7 +141,7 @@ public function upcast(array $block): ?array
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft und bereinigt Bausteine für eine neue Revision.
|
||||
* Prüft und bereinigt eine flache Bausteinliste (Fehlerschlüssel "blocks.N…").
|
||||
*
|
||||
* @param array<int|string, mixed> $blocks
|
||||
* @return list<array{id: string, type: string, v: int, variant: string, settings: array<string, mixed>, data: array<string, mixed>, refs: array<string, mixed>}>
|
||||
@@ -148,42 +152,53 @@ public function normalize(array $blocks): array
|
||||
$seenIds = [];
|
||||
|
||||
foreach (array_values($blocks) as $index => $block) {
|
||||
if (! is_array($block)) {
|
||||
throw ValidationException::withMessages([
|
||||
"blocks.$index" => 'Ein Baustein ist unvollständig.',
|
||||
]);
|
||||
}
|
||||
|
||||
if (! $this->has($block['type'] ?? null)) {
|
||||
throw ValidationException::withMessages([
|
||||
"blocks.$index.type" => 'Dieser Bausteintyp ist nicht freigegeben.',
|
||||
]);
|
||||
}
|
||||
|
||||
$type = $this->get($block['type']);
|
||||
|
||||
if (array_key_exists('v', $block) && (int) $block['v'] > $type->version()) {
|
||||
throw ValidationException::withMessages([
|
||||
"blocks.$index.v" => 'Dieser Baustein stammt aus einer neueren Programmfassung und kann hier nicht gespeichert werden.',
|
||||
]);
|
||||
}
|
||||
|
||||
$requested = $block['variant'] ?? null;
|
||||
$isCurrent = array_key_exists('v', $block) && (int) $block['v'] === $type->version();
|
||||
|
||||
if ($isCurrent && is_string($requested) && $requested !== '' && ! array_key_exists($requested, $type->variants())) {
|
||||
throw ValidationException::withMessages([
|
||||
"blocks.$index.variant" => 'Diese Darstellungsvariante ist für den Baustein nicht freigegeben.',
|
||||
]);
|
||||
}
|
||||
|
||||
$widget = $this->upcast($block);
|
||||
$normalized[] = $this->validateOne($type, $widget, $index, $seenIds);
|
||||
$normalized[] = $this->normalizeWidget($block, "blocks.$index", $seenIds);
|
||||
}
|
||||
|
||||
return $normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft und bereinigt einen einzelnen Baustein für eine neue Revision. Der Aufrufer führt die Menge
|
||||
* bereits vergebener Kennungen über die ganze Seite, damit kopierte Widgets neue Kennungen erhalten.
|
||||
*
|
||||
* @param array<string, true> $seenIds
|
||||
* @return array{id: string, type: string, v: int, variant: string, settings: array<string, mixed>, data: array<string, mixed>, refs: array<string, mixed>}
|
||||
*/
|
||||
public function normalizeWidget(mixed $block, string $errorPrefix, array &$seenIds): array
|
||||
{
|
||||
if (! is_array($block)) {
|
||||
throw ValidationException::withMessages([
|
||||
$errorPrefix => 'Ein Baustein ist unvollständig.',
|
||||
]);
|
||||
}
|
||||
|
||||
if (! $this->has($block['type'] ?? null)) {
|
||||
throw ValidationException::withMessages([
|
||||
"$errorPrefix.type" => 'Dieser Bausteintyp ist nicht freigegeben.',
|
||||
]);
|
||||
}
|
||||
|
||||
$type = $this->get($block['type']);
|
||||
|
||||
if (array_key_exists('v', $block) && (int) $block['v'] > $type->version()) {
|
||||
throw ValidationException::withMessages([
|
||||
"$errorPrefix.v" => 'Dieser Baustein stammt aus einer neueren Programmfassung und kann hier nicht gespeichert werden.',
|
||||
]);
|
||||
}
|
||||
|
||||
$requested = $block['variant'] ?? null;
|
||||
$isCurrent = array_key_exists('v', $block) && (int) $block['v'] === $type->version();
|
||||
|
||||
if ($isCurrent && is_string($requested) && $requested !== '' && ! array_key_exists($requested, $type->variants())) {
|
||||
throw ValidationException::withMessages([
|
||||
"$errorPrefix.variant" => 'Diese Darstellungsvariante ist für den Baustein nicht freigegeben.',
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->validateOne($type, $this->upcast($block), $errorPrefix, $seenIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gespeicherte Bausteine einer Revision als aktuelle Hüllen; unbekannte Arten entfallen.
|
||||
*
|
||||
@@ -241,7 +256,7 @@ public function mediaPaths(?array $blocks): array
|
||||
* @param array<string, true> $seenIds
|
||||
* @return array{id: string, type: string, v: int, variant: string, settings: array<string, mixed>, data: array<string, mixed>, refs: array<string, mixed>}
|
||||
*/
|
||||
private function validateOne(WidgetType $type, array $widget, int $index, array &$seenIds): array
|
||||
private function validateOne(WidgetType $type, array $widget, string $errorPrefix, array &$seenIds): array
|
||||
{
|
||||
$errors = new WidgetErrors;
|
||||
|
||||
@@ -292,7 +307,7 @@ private function validateOne(WidgetType $type, array $widget, int $index, array
|
||||
if (! $errors->isEmpty()) {
|
||||
$messages = [];
|
||||
foreach ($errors->all() as $key => $list) {
|
||||
$messages["blocks.$index.$key"] = $list;
|
||||
$messages["$errorPrefix.$key"] = $list;
|
||||
}
|
||||
|
||||
throw ValidationException::withMessages($messages);
|
||||
|
||||
Reference in new issue
Block a user