Skip to content

Commit 543ad0c

Browse files
committed
Add nav items to panel
1 parent a92dcc0 commit 543ad0c

5 files changed

+24
-1
lines changed

config/filament-flexible-content-block-pages.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Filament\Http\Middleware\AuthenticateSession;
66
use Filament\Http\Middleware\DisableBladeIconComponents;
77
use Filament\Http\Middleware\DispatchServingFilamentEvent;
8+
use Filament\Navigation\NavigationItem;
89
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
910
use Illuminate\Cookie\Middleware\EncryptCookies;
1011
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
@@ -56,6 +57,12 @@
5657
'auth_middleware' => [
5758
Authenticate::class,
5859
],
60+
'navigation_items' => [
61+
NavigationItem::make(fn () => flexiblePagesTrans('panel.navigation_items.go_to_website_lbl'))
62+
->url('/')->openUrlInNewTab()
63+
->icon('heroicon-o-globe-alt')
64+
->sort(-100),
65+
],
5966
],
6067

6168
'seo' => [

resources/lang/en/filament-flexible-content-block-pages.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,9 @@
5555
'tag_type_lbl' => 'Tag type',
5656
'tag_type_hint' => 'You can assign a type to use this tag only on certain page types.',
5757
],
58+
'panel' => [
59+
'navigation_items' => [
60+
'go_to_website_lbl' => 'View the website',
61+
]
62+
],
5863
];

resources/lang/nl/filament-flexible-content-block-pages.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,9 @@
5555
'tag_type_lbl' => 'Tag type',
5656
'tag_type_hint' => 'Je kunt een type toewijzen om deze tag alleen op bepaalde paginatypes te gebruiken.',
5757
],
58+
'panel' => [
59+
'navigation_items' => [
60+
'go_to_website_lbl' => 'Bekijk de website',
61+
]
62+
],
5863
];

src/FilamentFlexibleContentBlockPagesConfig.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ public function getRouteHelper(): HandlesPageRoutes
155155
return $this->routeHelper;
156156
}
157157

158+
public function getPanelNavigationItems(): array
159+
{
160+
return $this->packageConfig('panel.navigation_items', []);
161+
}
162+
158163
private function packageConfig(string $configKey, $default = null): mixed
159164
{
160165
return config('filament-flexible-content-block-pages.'.$configKey);

src/FlexibleContentBlockPagesPanel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public function panel(Panel $panel): Panel
2121
->resources(FilamentFlexibleContentBlockPages::config()->getResources())
2222
->plugin(FlexibleContentBlockPagesPlugin::make())
2323
->plugin(SpatieLaravelTranslatablePlugin::make()
24-
->defaultLocales(FilamentFlexibleContentBlockPages::config()->getSupportedLocales()));
24+
->defaultLocales(FilamentFlexibleContentBlockPages::config()->getSupportedLocales()))
25+
->navigationItems(FilamentFlexibleContentBlockPages::config()->getPanelNavigationItems());
2526
}
2627
}

0 commit comments

Comments
 (0)