@props(['data' => []])
{{-- Gallery block — grid of images (FileUpload::multiple stores flat array of paths) --}}
@php
$columns = $data['columns'] ?? 3;
$images = $data['images'] ?? [];
$sharedAlt = $data['alt'] ?? '';
@endphp
@if(!empty($images))
@foreach($images as $imgPath)
@php
// Handle both string paths and legacy object format
if (is_array($imgPath)) {
$gPath = $imgPath['path'] ?? ($imgPath[0] ?? '');
$altText = $imgPath['alt'] ?? $sharedAlt;
} else {
$gPath = (string) $imgPath;
$altText = $sharedAlt;
}
$gSrc = $gPath && !str_starts_with($gPath, 'http')
? Storage::disk('public')->url($gPath)
: $gPath;
@endphp
@if($gPath)
@endif
@endforeach
@endif