Prüfe Altseiten im echten Altformat und zeige Speicherfehler am Abschnitt.
CI Feature / test (push) Successful in 29s
Deploy Test / test (push) Successful in 26s
Deploy Test / deploy (push) Successful in 31s

- Der Altseiten-Test schreibt die Seederdaten vor dem Vergleich im flachen
  Format zurück, wie sie auf Test und Produktion liegen (die Migration
  speichert sie inzwischen über die Registry); zusätzlich ein Rundlauf
  Editor -> Speichern -> Veröffentlichen.
- Fehler, die erst die Registry erkennt, erscheinen als Meldung mit
  Abschnittsnummer und Art (Felder liegen im Dialog).
- Seite anlegen übernimmt die gewählten Säulen (wurden bisher verworfen).
- Nach dem Speichern wird der Editor neu befüllt, damit duplizierte
  Abschnitte ihre Kennung behalten.
- Entwicklerdokumentation der Registry inkl. Rollback-Hinweis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-11-17 18:01:55 +01:00
1 parent 9d936bfa4a
commit 2dc479a8a4
6 files changed
+274 -8

No files matched your search

@@ -2,6 +2,7 @@
namespace App\Filament\Resources\Pages\Pages;
use App\Domain\Catalog\PillarService;
use App\Domain\Cms\Page;
use App\Domain\Cms\PageService;
use App\Filament\Resources\Pages\PageResource;
@@ -39,9 +40,13 @@ protected function handleRecordCreation(array $data): Model
auth()->user(),
);
app(PillarService::class)->assignPages($page, array_map(intval(...), $data['pillars'] ?? []));
return $page;
});
} catch (ValidationException $exception) {
WidgetEditor::notifyErrors($exception->errors(), $blocks);
throw ValidationException::withMessages(
WidgetEditor::mapErrors($exception->errors(), array_keys($this->data['blocks'] ?? [])),
);
@@ -68,6 +68,16 @@ protected function getSavedNotificationTitle(): ?string
return 'Entwurf gespeichert. Die Live-Seite bleibt unverändert, bis Sie veröffentlichen.';
}
/**
* Nach dem Speichern den Editor aus der gespeicherten Revision neu befüllen, damit duplizierte
* Abschnitte ihre beim Speichern vergebene Kennung behalten.
*/
protected function afterSave(): void
{
$this->record->unsetRelation('latestRevision');
$this->fillForm();
}
/**
* @param array<string, mixed> $data
* @return array<string, mixed>
@@ -96,6 +106,8 @@ protected function handleRecordUpdate(Model $record, array $data): Model
$path = $service->availablePath($data['path'], $record);
$service->saveRevision($record, $blocks, $data['seo_title'] ?? null, $data['seo_description'] ?? null, auth()->user());
} catch (ValidationException $exception) {
WidgetEditor::notifyErrors($exception->errors(), $blocks);
throw ValidationException::withMessages(
WidgetEditor::mapErrors($exception->errors(), array_keys($this->data['blocks'] ?? [])),
);
+32
View File
@@ -12,6 +12,7 @@
use Filament\Forms\Components\RichEditor\RichContentRenderer;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\ToggleButtons;
use Filament\Notifications\Notification;
use Filament\Schemas\Components\Group;
use Illuminate\Foundation\Vite;
use Illuminate\Support\HtmlString;
@@ -173,6 +174,37 @@ public static function mapErrors(array $errors, array $itemKeys, string $statePa
return $mapped;
}
/**
* Fehler aus der Registry als sichtbare Meldung: Die Felder eines Abschnitts liegen im Bearbeitungsdialog
* und sind nach dem Speichern nicht auf der Seite sichtbar. Die Meldung nennt Abschnittsnummer und Art.
*
* @param array<string, list<string>> $errors
* @param array<int|string, mixed> $blocks Bausteine in Anzeigereihenfolge
*/
public static function notifyErrors(array $errors, array $blocks): void
{
$registry = app(WidgetRegistry::class);
$blocks = array_values($blocks);
$lines = [];
foreach ($errors as $key => $messages) {
if (preg_match('/^blocks\.(\d+)/', (string) $key, $match) === 1) {
$type = $blocks[(int) $match[1]]['type'] ?? null;
$label = $registry->has($type) ? $registry->get($type)->label() : 'Abschnitt';
$lines[] = 'Abschnitt '.((int) $match[1] + 1).' ('.$label.'): '.implode(' ', (array) $messages);
} else {
$lines[] = implode(' ', (array) $messages);
}
}
Notification::make()
->title('Nicht gespeichert')
->body(implode("\n", array_unique($lines)))
->danger()
->persistent()
->send();
}
/**
* Blockvorschau: dieselbe Widget-Ansicht wie öffentlich, aus dem ungespeicherten Zustand.
*