Wähle das Vorschaubild am Medium und nutze es als Standard in der Anzeige und in Modulen.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
f86032cb5f
commit
8e77defaca
18 files changed
+664
-26
No files matched your search
@@ -15,10 +15,12 @@
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use App\Domain\Catalog\PillarService;
|
||||
use App\Domain\Catalog\ReleaseContent;
|
||||
use App\Domain\Media\ThumbnailRef;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Filament\Support\ElementRevision;
|
||||
use App\Filament\Support\MediaUploadLimit;
|
||||
use App\Filament\Support\ReportsDomainRules;
|
||||
use App\Jobs\DeriveThumbnail;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\CheckboxList;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
@@ -102,9 +104,27 @@ public function form(Schema $schema): Schema
|
||||
return $options;
|
||||
})
|
||||
->helperText('Wirkt auf die Suche und legt keine neue Fassung an.'),
|
||||
FileUpload::make('thumbnail_upload')->label('Vorschaubild')
|
||||
Placeholder::make('thumbnail_current')->label('Aktuelles Vorschaubild')->content(function (): HtmlString {
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
$url = ThumbnailRef::url('editorial.card', 'element', $element->id, $element->thumbnail_path);
|
||||
$caption = match ($element->thumbnail_source) {
|
||||
'eigen' => 'Eigenes Vorschaubild.',
|
||||
'datei' => 'Vorschaubild aus der Datei des Mediums.',
|
||||
default => '',
|
||||
};
|
||||
if (is_string($element->thumbnail_source) && preg_match('/^frame:\d+@([\d.]+)$/', $element->thumbnail_source, $match) === 1) {
|
||||
$caption = 'Vorschaubild aus dem Film bei '.$match[1].' Sekunden.';
|
||||
}
|
||||
if ($url === null) {
|
||||
return new HtmlString('Noch kein Vorschaubild. Eine Filmstelle wählst du beim Ansehen des Mediums.');
|
||||
}
|
||||
|
||||
return new HtmlString('<img src="'.e($url).'" alt="" style="width: 16rem; height: auto;">'.($caption !== '' ? '<p>'.e($caption).'</p>' : ''));
|
||||
}),
|
||||
FileUpload::make('thumbnail_upload')->label('Eigenes Vorschaubild')
|
||||
->disk('cms_incoming')->directory('vorschau')->visibility('private')->image()
|
||||
->helperText('Nur die Karte. Die Inhaltsfassung bleibt unverändert.'),
|
||||
->helperText('Gilt für die Anzeige und als Vorschlag in Modulen und Programmen. Eine Filmstelle wählst du beim Ansehen. Speichern legt keine Fassung an.'),
|
||||
CheckboxList::make('pillars')
|
||||
->label('Fachliche Säulen')
|
||||
->options(fn (): array => Pillar::query()->orderBy('name')->pluck('name', 'id')->all())
|
||||
@@ -209,10 +229,9 @@ protected function handleRecordUpdate(Model $record, array $data): Model
|
||||
$record->save();
|
||||
}
|
||||
if (is_string($data['thumbnail_upload'] ?? null) && $data['thumbnail_upload'] !== '') {
|
||||
$record->thumbnail_path = $data['thumbnail_upload'];
|
||||
$record->thumbnail_error = null;
|
||||
$record->thumbnail_alt = $record->working_title;
|
||||
$record->save();
|
||||
DeriveThumbnail::dispatch('element', $record->id, $data['thumbnail_upload']);
|
||||
}
|
||||
if (array_key_exists('dimension_ids', $data)) {
|
||||
$ids = array_map(intval(...), $data['dimension_ids'] ?? []);
|
||||
|
||||
Reference in new issue
Block a user