@foreach($customFields as $field)
{{-- IMAGE SECTION --}}
@if($field->custom_type == 'image')
{{ $customTitles['image'] ?? '' }}
@foreach(json_decode($field->custom_field)->data as $image)
@php
$words = explode(' ', $image->description);
$shortDescription = implode(' ', array_slice($words, 0, 15));
@endphp
@endforeach
@elseif($field->custom_type == 'slider')
{{-- SLIDER SECTION --}}
{{ $customTitles['slider'] ?? '' }}
@php $first = true; @endphp
@foreach(json_decode($field->custom_field)->data as $slide)
{{ $slide->title }}
{{ $slide->description }}
@php $first = false; @endphp
@endforeach
@elseif($field->custom_type == 'text')
{{-- TEXT SECTION --}}
{{ $customTitles['text'] ?? '' }}
@foreach(json_decode($field->custom_field)->data as $text)
{!! $text->content !!}
@endforeach
@elseif($field->custom_type == 'video')
{{ $customTitles['video'] ?? '' }}
@foreach(json_decode($field->custom_field)->data as $video)
@php
$url = $video->url;
$parsed_url = parse_url($url);
$embed_url = null;
if (isset($parsed_url['host'])) {
if (strpos($parsed_url['host'], 'youtube.com') !== false) {
parse_str($parsed_url['query'], $params);
$video_id = $params['v'] ?? '';
$embed_url = "https://www.youtube.com/embed/{$video_id}";
} elseif (strpos($parsed_url['host'], 'youtu.be') !== false) {
$video_id = ltrim($parsed_url['path'], '/');
$embed_url = "https://www.youtube.com/embed/{$video_id}";
}
}
@endphp
@if($embed_url)
@endif
@endforeach
@elseif($field->custom_type == 'faq')
{{ $customTitles['faq'] ?? '' }}
@php $index = 0; @endphp
@foreach($customFields->where('custom_type', 'faq') as $field)
@foreach(json_decode($field->custom_field)->data as $faq)
@php $index++; @endphp
@endforeach
@endforeach
@elseif($field->custom_type == 'gallery')
{{ $customTitles['gallery'] ?? '' }}
@foreach($customFields->where('custom_type', 'gallery') as $field)
@foreach(json_decode($field->custom_field)->data as $image)
@endforeach
@endforeach
@endif
@endforeach
{{-- Custom Field --}}
{{-- Custom Field --}}