find($element); if (! $element instanceof ContentElement || $element->website_released_at === null) { return null; } $path = $element->website_public_path; $expected = '#^website/'.$element->id.'/datei\.[a-z0-9]+$#'; if (! is_string($path) || preg_match($expected, $path) !== 1) { return null; } if (! Storage::disk('media_public')->exists($path)) { return null; } $title = trim((string) ($element->display_title ?: $element->working_title)); $alt = trim((string) ($element->website_alt ?? '')); return new WebsitePresentation( elementId: $element->id, title: $title, alt: $alt !== '' ? $alt : $title, credit: filled($element->website_credit) ? trim((string) $element->website_credit) : null, kind: $element->output_class === 'film' ? 'film' : 'bild', url: route('website.media', $element), ); } /** * Slideshow: freigegebene Medien in der angegebenen Reihenfolge. Nicht freigegebene Einträge entfallen. * * @param list $ids * @return list */ public function presentMany(array $ids): array { $presentations = []; foreach ($ids as $id) { if (! is_numeric($id)) { continue; } $presentation = $this->present((int) $id); if ($presentation !== null) { $presentations[] = $presentation; } } return $presentations; } }