@if (!empty($data['page_init']['setting']['logo']['header']))
L&E Beyond
@endif @php $headerNavLinkIsExternal = static function (?string $href): bool { if (empty($href) || $href === '#') { return false; } if (str_starts_with($href, '//')) { $host = parse_url('https:' . $href, PHP_URL_HOST); return !empty($host) && strcasecmp((string) $host, request()->getHost()) !== 0; } $host = parse_url($href, PHP_URL_HOST); return !empty($host) && strcasecmp((string) $host, request()->getHost()) !== 0; }; $headerNavStripBasePath = static function (string $path): string { $path = '/' . ltrim($path, '/'); $base = rtrim(request()->getBasePath(), '/') ?: ''; if ($base !== '' && ($path === $base || str_starts_with($path, $base . '/'))) { $path = strlen($path) === strlen($base) ? '/' : substr($path, strlen($base)); if ($path === '' || $path[0] !== '/') { $path = '/' . ltrim((string) $path, '/'); } } return rtrim($path, '/') ?: '/'; }; $headerNavResolveFullUrl = static function (string $href): string { if (str_starts_with($href, '//')) { return request()->getScheme() . ':' . $href; } if (!str_contains($href, '://')) { return url()->to($href); } return $href; }; $normalizeHeaderNavPathForActive = static function (?string $href) use ($headerNavLinkIsExternal, $headerNavStripBasePath, $headerNavResolveFullUrl): ?string { if (empty($href) || $href === '#') { return null; } if ($headerNavLinkIsExternal($href)) { return null; } $full = $headerNavResolveFullUrl($href); $path = parse_url($full, PHP_URL_PATH); if ($path === false || $path === null || $path === '') { $path = '/'; } return $headerNavStripBasePath((string) $path); }; $headerCurrentPath = $headerNavStripBasePath((string) (parse_url(request()->url(), PHP_URL_PATH) ?: '/')); @endphp @if (!empty($data['page_init']['menu']))
@foreach ($data['page_init']['menu'] as $item) @php $itemPath = $normalizeHeaderNavPathForActive($item['url'] ?? null); $hasActiveSub = false; if (!empty($item['sub'])) { foreach ($item['sub'] as $_sub) { if ($normalizeHeaderNavPathForActive($_sub['url'] ?? null) === $headerCurrentPath) { $hasActiveSub = true; break; } } } $item_is_active = ($itemPath !== null && $itemPath === $headerCurrentPath) || $hasActiveSub; @endphp @if (empty($item['sub'])) {{ $item['name'] }} @else
{{ $item['name'] }}
@foreach ($item['sub'] as $sub) @php $subPath = $normalizeHeaderNavPathForActive($sub['url'] ?? null); $sub_is_active = $subPath !== null && $subPath === $headerCurrentPath; @endphp {{ $sub['name'] }} @endforeach
@endif @endforeach
@endif
Quote Search
@foreach (languages() as $code => $language) @if ($code == app()->getLocale()) {{ $language['name'] ?? $code }} {{ strtoupper($code) }} @else {{ $language['name'] ?? $code }} {{ strtoupper($code) }} @endif @endforeach
@if (!empty($data['page_init']['menu'])) @foreach ($data['page_init']['menu'] as $item) @php $itemPath = $normalizeHeaderNavPathForActive($item['url'] ?? null); $hasActiveSub = false; if (!empty($item['sub'])) { foreach ($item['sub'] as $_sub) { if ($normalizeHeaderNavPathForActive($_sub['url'] ?? null) === $headerCurrentPath) { $hasActiveSub = true; break; } } } $item_is_active = ($itemPath !== null && $itemPath === $headerCurrentPath) || $hasActiveSub; $mobileNavDropdownId = 'mobile-nav-' . ($item['id'] ?? $loop->index); @endphp @if (empty($item['sub'])) {{ $item['name'] }} @else
@foreach ($item['sub'] as $sub) @php $subPath = $normalizeHeaderNavPathForActive($sub['url'] ?? null); $sub_is_active = $subPath !== null && $subPath === $headerCurrentPath; @endphp {{ $sub['name'] }} @endforeach
@endif @endforeach @endif