diff --git a/resources/views/language-switch.blade.php b/resources/views/language-switch.blade.php
index 6f89b94..83111a8 100644
--- a/resources/views/language-switch.blade.php
+++ b/resources/views/language-switch.blade.php
@@ -1,4 +1,5 @@
@php
+ $languageSwitch = \BezhanSalleh\FilamentLanguageSwitch\LanguageSwitch::make();
$locales = $languageSwitch->getLocales();
$isCircular = $languageSwitch->isCircular();
$isFlagsOnly = $languageSwitch->isFlagsOnly();
@@ -11,20 +12,21 @@
default => 'bottom-end',
};
@endphp
-
-@if ($isDisplayOn)
-
str_contains($alignment, 'top'),
- 'bottom-0' => str_contains($alignment, 'bottom'),
- 'justify-start' => str_contains($alignment, 'left'),
- 'justify-end' => str_contains($alignment, 'right'),
- 'justify-center' => str_contains($alignment, 'center'),
- ])>
-
- @include('filament-language-switch::switch')
+
+ @if ($isDisplayOn)
+
str_contains($alignment, 'top'),
+ 'bottom-0' => str_contains($alignment, 'bottom'),
+ 'justify-start' => str_contains($alignment, 'left'),
+ 'justify-end' => str_contains($alignment, 'right'),
+ 'justify-center' => str_contains($alignment, 'center'),
+ ])>
+
+ @include('filament-language-switch::switch')
+
-
-@else
- @include('filament-language-switch::switch')
-@endif
\ No newline at end of file
+ @else
+ @include('filament-language-switch::switch')
+ @endif
+
\ No newline at end of file
diff --git a/resources/views/switch.blade.php b/resources/views/switch.blade.php
index 0eea722..5579521 100644
--- a/resources/views/switch.blade.php
+++ b/resources/views/switch.blade.php
@@ -16,8 +16,7 @@ class="fi-dropdown fi-user-menu"
x-tooltip="{
content: @js($languageSwitch->getLabel(app()->getLocale())),
theme: $store.theme,
- arrowless: true,
- placement: 'right'
+ placement: 'bottom'
}"
@endif
>
@@ -43,7 +42,6 @@ class="fi-dropdown fi-user-menu"
x-tooltip="{
content: @js($languageSwitch->getLabel($locale)),
theme: $store.theme,
- arrowless: true,
placement: 'right'
}"
@endif
diff --git a/src/Http/Livewire/FilamentLanguageSwitch.php b/src/Http/Livewire/FilamentLanguageSwitch.php
index 713bec2..be7d8b9 100644
--- a/src/Http/Livewire/FilamentLanguageSwitch.php
+++ b/src/Http/Livewire/FilamentLanguageSwitch.php
@@ -2,7 +2,6 @@
namespace BezhanSalleh\FilamentLanguageSwitch\Http\Livewire;
-use BezhanSalleh\FilamentLanguageSwitch\LanguageSwitch;
use Illuminate\Contracts\View\View;
use Livewire\Component;
@@ -22,8 +21,6 @@ public function changeLocale($locale)
public function render(): View
{
- return view('filament-language-switch::language-switch', [
- 'languageSwitch' => LanguageSwitch::make(),
- ]);
+ return view('filament-language-switch::language-switch');
}
}
diff --git a/src/LanguageSwitch.php b/src/LanguageSwitch.php
index 36aed8d..37c4f4a 100755
--- a/src/LanguageSwitch.php
+++ b/src/LanguageSwitch.php
@@ -53,13 +53,13 @@ public static function boot(): void
FilamentView::registerRenderHook(
name: $static->getRenderHook(),
- hook: fn (): string => Blade::render('@livewire(\'filament-language-switch\')')
+ hook: fn (): string => Blade::render('
')
);
if ($static->isDisplayOn()) {
FilamentView::registerRenderHook(
name: 'panels::body.end',
- hook: fn (): string => Blade::render('@livewire(\'filament-language-switch\')')
+ hook: fn (): string => Blade::render('@livewire(\'filament-language-switch\', key(\'fls-outside-panels\'))')
);
}
}
@@ -222,4 +222,9 @@ public function getLabel(string $locale): string
{
return $this->labels[$locale] ?? locale_get_display_name($locale, $this->getDisplayLocale());
}
+
+ public function generateId(): string
+ {
+ return str()->random(8);
+ }
}