From 391e0dcc7fb95fcc8f3fccd292b1c52c954f55d5 Mon Sep 17 00:00:00 2001 From: Anastas Mironov Date: Tue, 3 Sep 2024 13:07:43 +0900 Subject: [PATCH] feat: add configurable filament navigation group --- config/admin-kit-articles.php | 2 ++ resources/lang/en/articles.php | 1 + resources/lang/ru/articles.php | 1 + src/UI/Filament/Resources/ArticleResource.php | 9 +++++++++ 4 files changed, 13 insertions(+) diff --git a/config/admin-kit-articles.php b/config/admin-kit-articles.php index 028f4fe..e34f8d3 100644 --- a/config/admin-kit-articles.php +++ b/config/admin-kit-articles.php @@ -29,4 +29,6 @@ 'enabled' => true, 'is_wysiwyg' => true, ], + + 'navigation_group_enabled' => false, ]; diff --git a/resources/lang/en/articles.php b/resources/lang/en/articles.php index 3f809fb..b538c98 100644 --- a/resources/lang/en/articles.php +++ b/resources/lang/en/articles.php @@ -8,6 +8,7 @@ 'id' => 'ID', 'image' => 'Image', 'title' => 'Title', + 'navigation_group' => 'News', 'slug' => 'Slug', 'content' => 'Content', 'short_content' => 'Short Content', diff --git a/resources/lang/ru/articles.php b/resources/lang/ru/articles.php index 29556a9..d611c03 100644 --- a/resources/lang/ru/articles.php +++ b/resources/lang/ru/articles.php @@ -8,6 +8,7 @@ 'id' => 'ID', 'image' => 'Изображение', 'title' => 'Заголовок', + 'navigation_group' => 'Новости', 'slug' => 'Slug', 'content' => 'Контент', 'short_content' => 'Короткий контент', diff --git a/src/UI/Filament/Resources/ArticleResource.php b/src/UI/Filament/Resources/ArticleResource.php index a269387..f646c31 100644 --- a/src/UI/Filament/Resources/ArticleResource.php +++ b/src/UI/Filament/Resources/ArticleResource.php @@ -27,6 +27,15 @@ class ArticleResource extends Resource protected static ?string $navigationIcon = 'heroicon-o-document-text'; + public static function getNavigationGroup(): ?string + { + if (! config('admin-kit-articles.navigation_group_enabled')) { + return null; + } + + return __('admin-kit-articles::articles.resource.navigation_group'); + } + public static function form(Form $form): Form { $components = [];