@php $videos = $section['parameters']['videos'] ?? []; $title = $section['parameters']['title'] ?? ''; $subtitle = $section['parameters']['subtitle'] ?? ''; if (!function_exists('getYoutubeId')) { function getYoutubeId($url) { if (!is_string($url)) return null; if (preg_match('/(?:youtube(?:-nocookie)?\.com\/(?:[^\/ \s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/i', $url, $match)) { return $match[1]; } return null; } } $validVideoIds = []; foreach($videos as $v) { $id = getYoutubeId($v['url'] ?? ''); if ($id) $validVideoIds[] = $id; } @endphp @if($title || $subtitle) @if($subtitle) {{ $subtitle }} @endif {{ $title }} @endif @if(!empty($validVideoIds)) @endif @section('other-scripts') @append
{{ $subtitle }}