getState() ?? []; $images = is_array($images) ? array_values(array_filter($images)) : []; $urls = array_values(array_map( fn ($path) => Storage::disk('public')->url($path), $images )); if (empty($urls)) { $html = '-'; return $this->wrapEmbeddedHtml($html); } $record = $this->getRecord(); $caption = match ($this->getName()) { 'photos_before' => $record?->surgery_before, 'photos_after' => $record?->sergery_after, default => null, }; $section = match ($this->getName()) { 'photos_before' => 'before', 'photos_after' => 'after', default => '', }; $captionAttr = $caption ? ' data-lb-caption="' . htmlspecialchars($caption, ENT_QUOTES, 'UTF-8') . '"' : ''; $sectionAttr = $section ? ' data-lb-section="' . $section . '"' : ''; $group = 'gallery-' . md5(implode(',', $urls)); $items = ''; foreach ($urls as $idx => $url) { $esc = e($url); $items .= <<
HTML; } $html = '
' . $items . '
'; return $this->wrapEmbeddedHtml($html); } }