Skip to content

Commit

Permalink
Drop use of hard-coded strings for render hooks internally in favor o…
Browse files Browse the repository at this point in the history
…f `LayoutRenderHook`
  • Loading branch information
Voltra authored Dec 24, 2024
1 parent 6406aa7 commit 64a1c5e
Showing 1 changed file with 52 additions and 48 deletions.
100 changes: 52 additions & 48 deletions resources/views/components/layouts/base.blade.php
Original file line number Diff line number Diff line change
@@ -1,67 +1,71 @@
@props([
'title' => null,
'dir' => 'ltr'
'dir' => 'ltr',
])

@use(Z3d0X\FilamentFabricator\View\LayoutRenderHook)

<!DOCTYPE html>
<html
lang="{{ str_replace('_', '-', app()->getLocale()) }}"
dir="{{ $dir }}"
class="filament-fabricator"
>
<head>
{{ \Filament\Support\Facades\FilamentView::renderHook('filament-fabricator::head.start') }}

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">

@foreach (\Z3d0X\FilamentFabricator\Facades\FilamentFabricator::getMeta() as $tag)
{{ $tag }}
@endforeach

@if ($favicon = \Z3d0X\FilamentFabricator\Facades\FilamentFabricator::getFavicon())
<link rel="icon" href="{{ $favicon }}">
@endif
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" dir="{{ $dir }}" class="filament-fabricator">

<head>
{{ \Filament\Support\Facades\FilamentView::renderHook(LayoutRenderHook::HEAD_START) }}

<title>{{ $title ? "{$title} - " : null }} {{ config('app.name') }}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">

@foreach (\Z3d0X\FilamentFabricator\Facades\FilamentFabricator::getMeta() as $tag)
{{ $tag }}
@endforeach

<style>
[x-cloak=""], [x-cloak="x-cloak"], [x-cloak="1"] { display: none !important; }
</style>
@if ($favicon = \Z3d0X\FilamentFabricator\Facades\FilamentFabricator::getFavicon())
<link rel="icon" href="{{ $favicon }}">
@endif

<title>{{ $title ? "{$title} - " : null }} {{ config('app.name') }}</title>

@foreach (\Z3d0X\FilamentFabricator\Facades\FilamentFabricator::getStyles() as $name => $path)
@if (\Illuminate\Support\Str::of($path)->startsWith('<'))
{!! $path !!}
@else
<link rel="stylesheet" href="{{ $path }}" />
@endif
@endforeach

{{ \Filament\Support\Facades\FilamentView::renderHook('filament-fabricator::head.end') }}
</head>
<style>
[x-cloak=""],
[x-cloak="x-cloak"],
[x-cloak="1"] {
display: none !important;
}
</style>

<body class="filament-fabricator-body">
{{ \Filament\Support\Facades\FilamentView::renderHook('filament-fabricator::body.start') }}

{{ $slot }}
@foreach (\Z3d0X\FilamentFabricator\Facades\FilamentFabricator::getStyles() as $name => $path)
@if (\Illuminate\Support\Str::of($path)->startsWith('<'))
{!! $path !!}
@else
<link rel="stylesheet" href="{{ $path }}" />
@endif
@endforeach

{{ \Filament\Support\Facades\FilamentView::renderHook(LayoutRenderHook::HEAD_END) }}
</head>

{{ \Filament\Support\Facades\FilamentView::renderHook('filament-fabricator::scripts.start') }}
<body class="filament-fabricator-body">
{{ \Filament\Support\Facades\FilamentView::renderHook(LayoutRenderHook::BODY_START) }}

{{ $slot }}

{{ \Filament\Support\Facades\FilamentView::renderHook(LayoutRenderHook::SCRIPTS_START) }}

@foreach (\Z3d0X\FilamentFabricator\Facades\FilamentFabricator::getScripts() as $name => $path)
@if (\Illuminate\Support\Str::of($path)->startsWith('<'))
{!! $path !!}
@else
<script defer src="{{ $path }}"></script>
@endif
@endforeach

@foreach (\Z3d0X\FilamentFabricator\Facades\FilamentFabricator::getScripts() as $name => $path)
@if (\Illuminate\Support\Str::of($path)->startsWith('<'))
{!! $path !!}
@else
<script defer src="{{ $path }}"></script>
@endif
@endforeach
@stack('scripts')

@stack('scripts')
{{ \Filament\Support\Facades\FilamentView::renderHook(LayoutRenderHook::SCRIPTS_END) }}

{{ \Filament\Support\Facades\FilamentView::renderHook('filament-fabricator::scripts.end') }}
{{ \Filament\Support\Facades\FilamentView::renderHook(LayoutRenderHook::BODY_END) }}
</body>

{{ \Filament\Support\Facades\FilamentView::renderHook('filament-fabricator::body.end') }}
</body>
</html>

0 comments on commit 64a1c5e

Please sign in to comment.