Ergänze die gemeinsame redaktionelle Basis an den Fachobjekten.
CI Feature / test (push) Successful in 54s
Deploy Test / test (push) Successful in 47s
Deploy Test / deploy (push) Successful in 24s

Texte, Materialart und Präsentationsmedien bleiben am Medium, Modul, Programm und Lizenzartikel und werden von Verwaltung und Karten aus derselben Quelle gelesen, ohne Fassung oder Lizenz zu verändern.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-19 07:54:36 +01:00
1 parent c4be6ed8dc
commit f29ea58fd5
40 files changed
+2311 -20

No files matched your search

@@ -3,6 +3,7 @@
namespace App\Domain\Cms\Widgets\Types;
use App\Domain\Catalog\ContentElement;
use App\Domain\Catalog\PresentationMedia;
use App\Domain\Cms\Catalog\CardSubject;
use App\Domain\Cms\Catalog\PublicMaterialReader;
use App\Domain\Cms\Widgets\RenderContext;
@@ -88,4 +89,13 @@ protected function cardStyle(): string
{
return 'media';
}
protected function centralCoverId(mixed $id): ?int
{
$element = is_numeric($id) ? ContentElement::query()->find((int) $id) : null;
return $element instanceof ContentElement
? app(PresentationMedia::class)->coverElementId($element)
: null;
}
}
@@ -137,6 +137,8 @@ public function dataRules(): array
return [
'action_label' => ['nullable', 'string', 'max:60'],
'note' => ['nullable', 'string', 'max:200'],
'heading' => ['nullable', 'string', 'max:200'],
'summary' => ['nullable', 'string', 'max:500'],
'alt' => ['nullable', 'string', 'max:300'],
'focus_x' => ['nullable', 'numeric', 'between:0,100'],
'focus_y' => ['nullable', 'numeric', 'between:0,100'],
@@ -178,7 +180,22 @@ public function editorSchema(): array
return [
Group::make([$this->subjectField()])->statePath('refs'),
Group::make([$action, $note])->statePath('data'),
Group::make([
$action,
$note,
TextInput::make('heading')
->label('Anzeigename nur für diese Karte')
->maxLength(200)
->live(onBlur: true)
->placeholder('Zentraler Anzeigename')
->helperText('Leer übernimmt den Anzeigenamen des Fachobjekts. Eine Eintragung gilt nur für diese Karte und ändert die Quelle nicht.'),
TextInput::make('summary')
->label('Teaser nur für diese Karte')
->maxLength(500)
->live(onBlur: true)
->placeholder('Zentraler Teaser oder Kurzbeschreibung')
->helperText('Leer übernimmt Teaser oder Kurzbeschreibung. Lehrinhalt, Rechte und Preise bleiben unberührt.'),
])->statePath('data'),
];
}
@@ -205,7 +222,7 @@ public function clean(array $data, array $refs, WidgetErrors $errors): array
$refs[$key] = $id;
$refs = ImageRefFields::clean($refs, $errors);
foreach (['action_label', 'note', 'alt'] as $field) {
foreach (['action_label', 'note', 'alt', 'heading', 'summary'] as $field) {
$data[$field] = filled($data[$field] ?? null) ? trim((string) $data[$field]) : null;
}
@@ -224,13 +241,22 @@ public function resolve(array $widget, RenderContext $context): array
$data = $widget['data'];
$subject = $this->subject($widget['refs'][$this->refKey()] ?? null, $context);
$heading = filled($data['heading'] ?? null) ? trim((string) $data['heading']) : null;
$lead = filled($data['summary'] ?? null) ? trim((string) $data['summary']) : null;
if ($subject instanceof CardSubject && ($heading !== null || $lead !== null)) {
$subject = $subject->withText($heading, $lead);
}
$storedImage = WebsiteImage::normalize($widget['refs']['image'] ?? null);
$imageRef = $storedImage ?? $this->centralCoverId($widget['refs'][$this->refKey()] ?? null);
return [
'subject' => $subject,
'cardStyle' => $subject?->style ?? $this->cardStyle(),
'imageUrl' => app(WebsiteImage::class)->url($widget['refs']['image'] ?? null, $context->preview),
'alt' => app(WebsiteImage::class)->alt($widget['refs']['image'] ?? null, $data['alt'] ?? null),
'imageNotice' => $context->preview ? app(WebsiteImage::class)->previewNotice($widget['refs']['image'] ?? null, 'Das Kartenbild') : null,
'imageUrl' => app(WebsiteImage::class)->url($imageRef, $context->preview),
'alt' => app(WebsiteImage::class)->alt($imageRef, $data['alt'] ?? null),
'imageNotice' => $context->preview ? app(WebsiteImage::class)->previewNotice($imageRef, 'Das Kartenbild') : null,
'focus' => PremiumFields::focus($data, 66, 45),
'format' => $option('format', 'landscape'),
'fit' => $option('fit', 'cover'),
@@ -261,6 +287,11 @@ public function summary(array $widget): string
return $label ?? 'Kein Objekt gewählt';
}
protected function centralCoverId(mixed $id): ?int
{
return null;
}
private function subjectField(): Select
{
return Select::make($this->refKey())
@@ -3,6 +3,7 @@
namespace App\Domain\Cms\Widgets\Types;
use App\Domain\Catalog\Composition;
use App\Domain\Catalog\PresentationMedia;
use App\Domain\Cms\Catalog\CardSubject;
use App\Domain\Cms\Catalog\PublicCatalogReader;
use App\Domain\Cms\Widgets\RenderContext;
@@ -97,4 +98,13 @@ protected function cardStyle(): string
{
return 'catalog';
}
protected function centralCoverId(mixed $id): ?int
{
$composition = is_numeric($id) ? Composition::query()->find((int) $id) : null;
return $composition instanceof Composition
? app(PresentationMedia::class)->coverElementId($composition)
: null;
}
}