@props([ 'title' => 'Archive detail hero image', 'heroImage' => null, // Provide either a full embed URL or only a YouTube video id. // Example videoId: "oAOUNZXGaJo" 'youtubeVideoId' => null, 'youtubeEmbedUrl' => null, // Optional: custom slides array (overrides heroImage/youtube* if provided) // Each item: ['type' => 'image'|'youtube', 'src' => '...', 'alt' => '...', 'title' => '...'] 'slides' => null, ]) @php // If custom slides are provided and non-empty, use them directly if (is_array($slides) && count($slides) > 0) { $resolvedSlides = $slides; } else { // Fallback: one image + optional single YouTube slide $defaultImage = 'https://images.pexels.com/photos/1190298/pexels-photo-1190298.jpeg?auto=compress&cs=tinysrgb&w=1600'; $imageSrc = $heroImage ?: $defaultImage; $videoSrc = $youtubeEmbedUrl; if (empty($videoSrc) && !empty($youtubeVideoId)) { $videoSrc = \Modules\Frontend\app\Support\YoutubeEmbed::playerUrl( "https://www.youtube-nocookie.com/embed/{$youtubeVideoId}?rel=0&modestbranding=1" ); } $resolvedSlides = [ [ 'type' => 'image', 'src' => $imageSrc, 'alt' => $title ?: 'Archive detail hero image', ], ]; if (!empty($videoSrc)) { $resolvedSlides[] = [ 'type' => 'youtube', 'src' => $videoSrc, 'title' => $title ?: 'YouTube video', ]; } } @endphp