Pflege Anzeigedaten ohne neue Fassung und zeige sie in den echten Karten.
Der Medieneditor trennt Beschreibung, Inhalt, Fassungen und Verwendung. Der vorhandene Picker filtert nach Zusammenhang und lässt Entwürfe für die gemeinsame Freigabe sichtbar. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3e56314cf9
commit
d37a7093dd
13 files changed
+827
-54
No files matched your search
@@ -104,8 +104,10 @@ public function labelFor(mixed $id): ?string
|
||||
|
||||
/**
|
||||
* Anzeigedaten für eine Karte. Öffentlich null, wenn das Element nicht öffentlich genannt wird.
|
||||
*
|
||||
* @param array<string, mixed> $draft ungespeicherte Anzeigedaten, nur für die Redaktionsvorschau
|
||||
*/
|
||||
public function subject(mixed $id, bool $includeNonPublic): ?CardSubject
|
||||
public function subject(mixed $id, bool $includeNonPublic, array $draft = []): ?CardSubject
|
||||
{
|
||||
$element = is_numeric($id) ? ContentElement::query()->with('editorialContentKind')->find((int) $id) : null;
|
||||
|
||||
@@ -119,11 +121,22 @@ public function subject(mixed $id, bool $includeNonPublic): ?CardSubject
|
||||
return null;
|
||||
}
|
||||
|
||||
$shown = clone $element;
|
||||
|
||||
foreach (['working_title', 'display_title', 'summary', 'thumbnail_path', 'thumbnail_alt'] as $field) {
|
||||
if (! array_key_exists($field, $draft)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$value = $draft[$field];
|
||||
$shown->setAttribute($field, is_string($value) && trim($value) === '' ? null : $value);
|
||||
}
|
||||
|
||||
$program = $this->publicProgramFor($element);
|
||||
$output = self::outputLabel((string) $element->output_class);
|
||||
$film = $element->output_class === 'film';
|
||||
$output = self::outputLabel((string) $shown->output_class);
|
||||
$film = $shown->output_class === 'film';
|
||||
$editorialKind = $element->editorialContentKind?->label;
|
||||
$summary = filled($element->summary) ? trim((string) $element->summary) : null;
|
||||
$summary = filled($shown->summary) ? trim((string) $shown->summary) : null;
|
||||
|
||||
$meta = [$output];
|
||||
if ($program !== null) {
|
||||
@@ -137,14 +150,14 @@ public function subject(mixed $id, bool $includeNonPublic): ?CardSubject
|
||||
if ($summary === null) {
|
||||
$missing[] = 'Keine Kurzbeschreibung gepflegt (Medium bearbeiten → Kurzbeschreibung).';
|
||||
}
|
||||
if (! filled($element->display_title)) {
|
||||
if (! filled($shown->display_title)) {
|
||||
$missing[] = 'Kein Anzeigetitel gepflegt; die Karte zeigt den Arbeitstitel.';
|
||||
}
|
||||
|
||||
$previewImage = $includeNonPublic ? ThumbnailRef::url('editorial.card', 'element', (int) $element->id, $element->thumbnail_path) : null;
|
||||
$previewImage = $includeNonPublic ? ThumbnailRef::url('editorial.card', 'element', (int) $element->id, $shown->thumbnail_path) : null;
|
||||
|
||||
return new CardSubject(
|
||||
title: (string) ($element->display_title ?: $element->working_title),
|
||||
title: (string) ($shown->display_title ?: $shown->working_title),
|
||||
summary: $summary,
|
||||
kind: filled($editorialKind) ? (string) $editorialKind : $output,
|
||||
badge: $output,
|
||||
@@ -172,6 +185,17 @@ public static function outputLabel(string $outputClass): string
|
||||
};
|
||||
}
|
||||
|
||||
public function visibilityNote(ContentElement $element): string
|
||||
{
|
||||
if ($this->isPublic($element)) {
|
||||
$program = $this->publicProgramFor($element);
|
||||
|
||||
return 'Öffentlich nur als Teil der Programmseite „'.($program['title'] ?? '').'“. Die Mediendatei wird dabei nicht ausgeliefert.';
|
||||
}
|
||||
|
||||
return $this->notice($element, $this->publicProgramFor($element));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array{id: int, title: string}|null $program
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user