File tree Expand file tree Collapse file tree 5 files changed +43
-22
lines changed Expand file tree Collapse file tree 5 files changed +43
-22
lines changed Original file line number Diff line number Diff line change 1
- @if (count (LaravelLocalization:: getSupportedLocales ()) > 1 )
2
- @php
3
- use \Illuminate\Support\Facades\ Route ;
1
+ @php
2
+ use Illuminate\Support\Facades\ Route ;
4
3
5
- $page = Route:: current ()-> parameter (' page' );
6
- @endphp
4
+ $page = Route:: current ()-> parameter (' page' );
5
+ @endphp
7
6
8
- <nav class =" relative inline-block text-right" >
9
- <div class =" py-1 flex" role =" none" >
10
- @foreach (LaravelLocalization:: getSupportedLocales () as $localeCode => $properties )
11
- <a href =" {{ $page && is_object ($page ) ? $page -> getViewUrl ($localeCode ) : ' #' } }"
12
- class =" text-gray-700 block px-4 py-2 text-sm"
13
- role =" menuitem"
14
- id =" menu-item-{{ $localeCode } }" >
15
- {{ $properties [' native' ] } }
16
- </a >
17
- @endforeach
18
- </div >
19
- </nav >
20
- @endif
7
+ <nav class =" relative inline-block text-right" >
8
+ <div class =" py-1 flex" role =" none" >
9
+ @foreach (LaravelLocalization:: getSupportedLocales () as $localeCode => $properties )
10
+ <a href =" {{ $page && is_object ($page ) ? $page -> getViewUrl ($localeCode ) : ' #' } }"
11
+ class =" text-gray-700 block px-4 py-2 text-sm"
12
+ role =" menuitem"
13
+ id =" menu-item-{{ $localeCode } }" >
14
+ {{ $properties [' native' ] } }
15
+ </a >
16
+ @endforeach
17
+ </div >
18
+ </nav >
Original file line number Diff line number Diff line change 7
7
8
8
<x-layouts .base title =" {{ $page -> title } }" wide =" true" >
9
9
<header >
10
- <x-language-switch />
10
+ <x-flexible-pages- language-switch />
11
11
</header >
12
12
13
13
<main class =" prose-headings:font-base" >
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ public function handle(): void
39
39
public function seedHomePage (): void
40
40
{
41
41
$ pageModel = FilamentFlexibleContentBlockPages::config ()->getPageModel ();
42
- if (! $ pageModel ::code (Page::HOME_PAGE )->exists ()) {
42
+ if (! $ pageModel ::code (Page::HOME_PAGE )->exists ()) {
43
43
$ locales = FilamentFlexibleContentBlockPages::config ()->getSupportedLocales ();
44
44
45
45
$ homePage = new $ pageModel ;
@@ -52,7 +52,7 @@ public function seedHomePage(): void
52
52
public function seedSettings (): void
53
53
{
54
54
$ settingsModel = FilamentFlexibleContentBlockPages::config ()->getSettingsModel ();
55
- if ($ settingsModel ::query ()->count () === 0 ) {
55
+ if ($ settingsModel ::query ()->count () === 0 ) {
56
56
$ locales = FilamentFlexibleContentBlockPages::config ()->getSupportedLocales ();
57
57
$ settings = new $ settingsModel ;
58
58
Original file line number Diff line number Diff line change 5
5
use Spatie \LaravelPackageTools \Package ;
6
6
use Spatie \LaravelPackageTools \PackageServiceProvider ;
7
7
use Statikbe \FilamentFlexibleContentBlockPages \Commands \SeedDefaultsCommand ;
8
+ use Statikbe \FilamentFlexibleContentBlockPages \View \Components \LanguageSwitch ;
8
9
9
10
class FilamentFlexibleContentBlockPagesServiceProvider extends PackageServiceProvider
10
11
{
@@ -25,6 +26,9 @@ public function configurePackage(Package $package): void
25
26
'create_filament_flexible_content_block_pages_settings_table ' ,
26
27
])
27
28
->hasTranslations ()
28
- ->hasCommand (SeedDefaultsCommand::class);
29
+ ->hasCommand (SeedDefaultsCommand::class)
30
+ ->hasViewComponents ('flexible-pages ' ,
31
+ LanguageSwitch::class,
32
+ );
29
33
}
30
34
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Statikbe \FilamentFlexibleContentBlockPages \View \Components ;
4
+
5
+ use Illuminate \View \Component ;
6
+ use Mcamara \LaravelLocalization \Facades \LaravelLocalization ;
7
+
8
+ class LanguageSwitch extends Component
9
+ {
10
+ public function render ()
11
+ {
12
+ return view ('filament-flexible-content-block-pages::components.language-switch ' );
13
+ }
14
+
15
+ public function shouldRender (): bool
16
+ {
17
+ return count (LaravelLocalization::getSupportedLocales ()) > 1 ;
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments