Wähle den Kartentext auch an der Programm- und Modulkarte und führe den Filmbild-Regler nach.
CI Feature / test (push) Successful in 1m46s
Deploy Test / test (push) Successful in 1m45s
Deploy Test / deploy (push) Successful in 36s

- Programm- und Modulkarte: „Text der Karte“ (Automatisch wie bisher: Teaser, sonst Kurzbeschreibung, sonst
  Lernziel; Teaser, Kurzbeschreibung, Ausführliche Beschreibung, Lernziel der Fassung). Eine ausdrückliche Wahl
  ersetzt nicht still; die Vorschau nennt, wo der Text zu pflegen ist. Das Vorschaubild des Programms oder Moduls
  lässt sich als Bild-Medium übernehmen (CompositionStill, additive Tabelle composition_still_sources).
- Filmbild im Dialog wie im Medienmanager: Regler und Zahlenfeld zeigen dieselbe Stelle, das Bild folgt dem Regler
  nach kurzer Pause, „Diese Stelle übernehmen“; das Vorschaubild des Films mit kleiner Ansicht daneben.
- Gemeinsame Meldung nach dem tatsächlichen Stand für Film- und Programmbilder.
- Test bewusst angepasst: Die Programmkarte hat jetzt eine Textwahl (vorher nur die Medienkarte).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-21 21:19:43 +01:00
1 parent 604e1791c5
commit 3825f53a9b
16 files changed
+641 -47

No files matched your search

@@ -265,6 +265,13 @@ public function subject(mixed $id, bool $includeNonPublic): ?CardSubject
$profile = app(EditorialProfileReader::class)->read($composition, 'kachel');
$summary = $profile->value('teaser') ?: $profile->value('summary');
$goal = filled($version?->learning_goal) ? trim((string) $version->learning_goal) : null;
// Zentrale Texte, aus denen die Redaktion den Kartentext wählen kann (Zielgruppe „Öffentliche Kachel“).
$texts = [
'teaser' => $profile->value('teaser'),
'summary' => $profile->value('summary'),
'description' => $profile->value('description'),
'goal' => $goal,
];
$missing = [];
if ($summary === null) {
@@ -313,6 +320,7 @@ public function subject(mixed $id, bool $includeNonPublic): ?CardSubject
visualLabel: $kind,
previewImage: $includeNonPublic ? ThumbnailRef::url('editorial.card', 'komposition', (int) $composition->id, $composition->thumbnail_path) : null,
missing: $missing,
texts: $texts,
);
}
@@ -8,6 +8,7 @@
use App\Domain\Cms\Catalog\PublicMaterialReader;
use App\Domain\Cms\Widgets\RenderContext;
use App\Domain\Media\FilmStill;
use App\Domain\Media\ThumbnailRef;
use Filament\Forms\Components\ViewField;
use Filament\Schemas\Components\Utilities\Get;
@@ -115,6 +116,7 @@ protected function imageSourceFields(): array
'filmTitle' => $film instanceof ContentElement ? (string) ($film->display_title ?: $film->working_title) : '',
'filmVersionId' => $version?->id,
'filmHasThumbnail' => $film instanceof ContentElement && is_string($film->thumbnail_path) && $film->thumbnail_path !== '',
'filmThumbnailUrl' => $film instanceof ContentElement ? ThumbnailRef::url('editorial.card', 'element', (int) $film->id, $film->thumbnail_path) : null,
'filmStartSecond' => $film instanceof ContentElement ? ($stills->thumbnailSecond($film) ?? '0') : '0',
];
}),
@@ -128,6 +130,11 @@ private function filmFor(mixed $id): ?ContentElement
return $element instanceof ContentElement && app(FilmStill::class)->refusal($element) === null ? $element : null;
}
protected function subjectNoun(): string
{
return 'Medium';
}
protected function textChoices(): array
{
return [
@@ -33,13 +33,6 @@ abstract class PremiumCardWidget extends WidgetType
{
public const SHOW = ['yes' => 'Anzeigen', 'no' => 'Ausblenden'];
/** Hinweise der Redaktionsvorschau, wenn der gewählte zentrale Text nicht gepflegt ist. */
public const TEXT_MISSING = [
'teaser' => 'Kein Teaser gepflegt (Medium bearbeiten → Teaser).',
'summary' => 'Keine Kurzbeschreibung gepflegt (Medium bearbeiten → Kurzbeschreibung).',
'description' => 'Keine ausführliche Beschreibung gepflegt (Medium bearbeiten → Beschreibung).',
];
/** Schlüssel des Fachobjekts in refs, zum Beispiel 'pillar'. */
abstract protected function refKey(): string;
@@ -85,6 +78,26 @@ protected function textChoices(): array
return [];
}
/** Was die Redaktion bearbeitet, um einen Text zu pflegen („Medium“, „Programm oder Modul“); für Hinweise. */
protected function subjectNoun(): string
{
return 'Objekt';
}
/** Hinweis der Redaktionsvorschau, wenn der gewählte zentrale Text nicht gepflegt ist. */
private function missingTextHint(string $field): string
{
$noun = $this->subjectNoun();
return match ($field) {
'teaser' => 'Kein Teaser gepflegt ('.$noun.' bearbeiten → Teaser).',
'summary' => 'Keine Kurzbeschreibung gepflegt ('.$noun.' bearbeiten → Kurzbeschreibung).',
'description' => 'Keine ausführliche Beschreibung gepflegt ('.$noun.' bearbeiten → Beschreibung).',
'goal' => 'Kein Lernziel gepflegt ('.$noun.' bearbeiten → Lernziel der Fassung).',
default => '',
};
}
public function view(): string
{
return 'widgets.premium_card';
@@ -283,7 +296,7 @@ public function resolve(array $widget, RenderContext $context): array
$textSource = $option('text_source', 'auto');
if ($subject instanceof CardSubject && $textSource !== 'auto' && isset($this->textChoices()[$textSource])) {
$subject = $subject->withTextChoice($textSource, self::TEXT_MISSING[$textSource] ?? '');
$subject = $subject->withTextChoice($textSource, $this->missingTextHint($textSource));
}
$heading = filled($data['heading'] ?? null) ? trim((string) $data['heading']) : null;
@@ -353,7 +366,7 @@ private function centralText(mixed $id, string $field, mixed $textSource = null)
}
if ($subject instanceof CardSubject && is_string($textSource) && isset($this->textChoices()[$textSource]) && $textSource !== 'auto') {
$subject = $subject->withTextChoice($textSource, self::TEXT_MISSING[$textSource] ?? '');
$subject = $subject->withTextChoice($textSource, $this->missingTextHint($textSource));
}
$text = $subject?->{$field};
@@ -7,6 +7,10 @@
use App\Domain\Cms\Catalog\CardSubject;
use App\Domain\Cms\Catalog\PublicCatalogReader;
use App\Domain\Cms\Widgets\RenderContext;
use App\Domain\Media\CompositionStill;
use App\Domain\Media\ThumbnailRef;
use Filament\Forms\Components\ViewField;
use Filament\Schemas\Components\Utilities\Get;
/**
* Modul- und Programmkarte (Kit v1.7 „catalog“): ein Programm oder Modul über PublicCatalogReader, dieselbe
@@ -41,6 +45,59 @@ public function schematic(): array
return [[2, 2, 56, 32, 'line'], [5, 5, 22, 26, 'ink'], [8, 24, 10, 2, 'accent'], [31, 8, 10, 2, 'line'], [31, 13, 22, 4, 'ink'], [31, 25, 14, 5, 'ink']];
}
/**
* Das Vorschaubild des Programms oder Moduls als Kartenbild übernehmen. Es wird einmal als Bild-Medium abgelegt
* (CompositionStill) und wie jedes andere Bild ausgewählt; die Karte liest nur diese Datei.
*/
protected function imageSourceFields(): array
{
return [
ViewField::make('_programmbild')
->label('Bild aus dem Programm oder Modul')
->view('filament.cms.kompositionsbild-feld')
->dehydrated(false)
->visible(fn (Get $get): bool => $this->compositionFor($get('composition')) !== null)
->viewData(function (Get $get): array {
$composition = $this->compositionFor($get('composition'));
return [
'composition' => $composition,
'compositionTitle' => $composition instanceof Composition ? (string) ($composition->display_title ?: $composition->designation) : '',
'compositionThumbnailUrl' => $composition instanceof Composition && app(CompositionStill::class)->hasThumbnail($composition)
? ThumbnailRef::url('editorial.card', 'komposition', (int) $composition->id, $composition->thumbnail_path)
: null,
];
}),
];
}
private function compositionFor(mixed $id): ?Composition
{
$composition = is_numeric($id) ? Composition::query()->with('editorialContentKind')->find((int) $id) : null;
return $composition instanceof Composition && app(PublicCatalogReader::class)->isCardSelectable($composition) ? $composition : null;
}
protected function subjectNoun(): string
{
return 'Programm oder Modul';
}
/**
* Wählbare Texte: die zentralen Texte des Programms oder Moduls und das Lernziel der Fassung. „Automatisch“ bleibt
* wie bisher: Teaser, sonst Kurzbeschreibung, sonst Lernziel. Die ausführliche Beschreibung erscheint nur auf Wahl.
*/
protected function textChoices(): array
{
return [
'auto' => 'Automatisch (Teaser, sonst Kurzbeschreibung, sonst Lernziel)',
'teaser' => 'Teaser',
'summary' => 'Kurzbeschreibung',
'description' => 'Ausführliche Beschreibung (erscheint öffentlich)',
'goal' => 'Lernziel der Fassung',
];
}
public function settings(): array
{
// Die Art (Programm oder Modul) bleibt immer sichtbar; sie lässt sich nicht ausblenden.