@props([ 'slides' => [], ]) @php $heroTitleFallback = site_profile()->label('hero_title', __('site.hero_home_title')); $heroSubtitleFallback = site_profile()->label('hero_subtitle', __('site.hero_home_subtitle')); $items = collect($slides) ->filter(fn ($row) => ! empty($row['image_url'])) ->values() ->map(function (array $row) use ($heroTitleFallback, $heroSubtitleFallback) { $title = trim((string) ($row['title'] ?? '')); $subtitle = trim((string) ($row['alt_text'] ?? '')); if ($subtitle !== '' && $subtitle === $title) { $subtitle = ''; } return [ 'id' => (int) ($row['id'] ?? 0), 'title' => $title !== '' ? $title : $heroTitleFallback, 'subtitle' => $subtitle !== '' ? $subtitle : ($title === '' ? $heroSubtitleFallback : ''), 'alt' => (string) ($row['alt_text'] ?? $row['title'] ?? ''), 'src' => (string) $row['image_url'], 'srcset' => $row['srcset'] ?? null, 'sizes' => $row['sizes'] ?? null, 'link' => filled($row['link'] ?? null) ? (string) $row['link'] : null, 'target' => ($row['target'] ?? '_self') === '_blank' ? '_blank' : '_self', ]; }) ->all(); @endphp @if (count($items) > 0)
@if (count($items) > 1) @endif
@endif