Mache Gestaltungsfehler sichtbar und schließe stille Verlustwege im Baustein
- Bausteindialog ohne Schließen-Kreuz: Verlassen nur über „Zur Seite“ oder „Änderungen verwerfen“. - Strg+S und Esc wirken nicht, solange ein Dialog offen ist. - Ein Raster- oder Gestaltungsfehler öffnet den betroffenen Abschnitt (CMS-12). - Nachtrag in Abnahme Teil B: Zeitfenster der Knopffarben-Regel berichtigt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
77ebb0c1d5
commit
bc6e4ec7ad
5 files changed
+79
-5
No files matched your search
@@ -152,7 +152,7 @@ protected function getFormActions(): array
|
||||
}
|
||||
|
||||
/**
|
||||
* Ein Fehler in einem gerade ausgeblendeten Register zeigt dieses Register.
|
||||
* Ein Fehler in einem gerade ausgeblendeten Register oder Abschnittsteil wird sichtbar gemacht (CMS-12).
|
||||
*/
|
||||
public function save(bool $shouldRedirect = true, bool $shouldSendSavedNotification = true): void
|
||||
{
|
||||
@@ -161,11 +161,48 @@ public function save(bool $shouldRedirect = true, bool $shouldSendSavedNotificat
|
||||
} catch (ValidationException $exception) {
|
||||
$keys = implode(' ', array_keys($exception->errors()));
|
||||
$this->register = str_contains($keys, 'data.sections') ? 'inhalt' : (preg_match('/data\.(path|seo_|pillars)/', $keys) === 1 ? 'einstellungen' : $this->register);
|
||||
$this->showFailingSection(array_keys($exception->errors()));
|
||||
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Raster und Gestaltung stehen nur im Kontext „Abschnitt gestalten“, andere Abschnitte sind dort ausgeblendet.
|
||||
* Liegt der Fehler im gestalteten Abschnitt, bleibt der Kontext. Ein Raster- oder Gestaltungsfehler öffnet den
|
||||
* betroffenen Abschnitt; jeder andere Abschnittsfehler (etwa die Platzübersicht) steht im Seitenaufbau.
|
||||
*
|
||||
* @param list<string> $errorKeys
|
||||
*/
|
||||
private function showFailingSection(array $errorKeys): void
|
||||
{
|
||||
$sectionKeys = array_map('strval', array_keys($this->data['sections'] ?? []));
|
||||
$failing = [];
|
||||
$design = null;
|
||||
|
||||
foreach ($errorKeys as $key) {
|
||||
if (preg_match('/^data\.sections\.([^.]+)(?:\.(.*))?$/', $key, $match) !== 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$index = array_search($match[1], $sectionKeys, true);
|
||||
if ($index === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$failing[] = $index;
|
||||
if ($design === null && preg_match('/^(layout|style)(\.|$)/', $match[2] ?? '') === 1) {
|
||||
$design = $index;
|
||||
}
|
||||
}
|
||||
|
||||
if ($failing === [] || ($this->abschnitt !== null && in_array($this->abschnitt, $failing, true))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->abschnitt = $design;
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [];
|
||||
|
||||
@@ -100,7 +100,8 @@ public static function slotBuilder(string $name = 'widget'): Builder
|
||||
->modalSubmitActionLabel('Zur Seite')
|
||||
->modalCancelActionLabel('Änderungen verwerfen')
|
||||
->closeModalByClickingAway(false)
|
||||
->closeModalByEscaping(false))
|
||||
->closeModalByEscaping(false)
|
||||
->modalCloseButton(false))
|
||||
->deleteAction(fn ($action) => $action->label('Entfernen')->tooltip('Widget aus diesem Platz entfernen')->requiresConfirmation()->modalHeading('Widget entfernen?')->modalDescription('Das Widget wird aus dem Entwurf entfernt. Gespeicherte Revisionen bleiben erhalten.')->modalSubmitActionLabel('Entfernen'))
|
||||
->columnSpanFull();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user