Skip to content

Commit a56449c

Browse files
committed
Implement undeletable toggle
Refactor menu field namespaces
1 parent b300c3b commit a56449c

15 files changed

+92
-14
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@
122122
| The Filament navigation menu sorting order of the page resource
123123
*/
124124
'navigation_sort' => 5,
125+
126+
'gates' => [
127+
'undeletable' => 'change_undeletable:page',
128+
],
125129
],
126130
// If you extend PageResource and want to use your own model, you can add your the extended page resource config for your own model here...
127131
],

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
'colour_lbl' => 'Color',
6464
'seo_description_lbl' => 'SEO description',
6565
'icon_lbl' => 'Icon',
66+
'is_undeletable_lbl' => 'Undeletable',
67+
'is_undeletable_helper' => 'Make this page undeletable by enabling this option.',
6668
],
6769
'tag_types' => [
6870
'navigation_group' => 'Settings',

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
'colour_lbl' => 'Couleur',
6464
'seo_description_lbl' => 'Description SEO',
6565
'icon_lbl' => 'Icône',
66+
'is_undeletable_lbl' => 'Non supprimable',
67+
'is_undeletable_helper' => 'Rendre la page non supprimable en activant cette option.',
6668
],
6769
'tag_types' => [
6870
'navigation_group' => 'Paramètres',

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
'colour_lbl' => 'Kleur',
6464
'seo_description_lbl' => 'SEO-beschrijving',
6565
'icon_lbl' => 'Icoon',
66+
'is_undeletable_lbl' => 'Onverwijderbaar',
67+
'is_undeletable_helper' => 'Maak de pagina onverwijderbaar door deze optie in te schakelen.',
6668
],
6769
'tag_types' => [
6870
'navigation_group' => 'Instellingen',

src/FilamentFlexibleContentBlockPagesConfig.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,14 @@ public function isReplicateActionOnTableEnabled(string $modelClass): bool
341341
return $this->packageConfig("page_resource.{$modelClass}.enable_replicate_action_on_table", false);
342342
}
343343

344+
/**
345+
* @param class-string<Model> $modelClass
346+
*/
347+
public function getUndeletableGate(string $modelClass): ?string
348+
{
349+
return $this->packageConfig("page_resource.{$modelClass}.gates.undeletable");
350+
}
351+
344352
public function getPageNavigationSort(string $modelClass): ?int
345353
{
346354
return $this->packageConfig("page_resource.{$modelClass}.navigation_sort");

src/Form/Fields/Types/AbstractMenuItemType.php renamed to src/Form/Components/MenuItemTypes/AbstractMenuItemType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Statikbe\FilamentFlexibleContentBlockPages\Form\Fields\Types;
3+
namespace Statikbe\FilamentFlexibleContentBlockPages\Form\Components\MenuItemTypes;
44

55
abstract class AbstractMenuItemType
66
{

src/Form/Fields/Types/LinkableMenuItemType.php renamed to src/Form/Components/MenuItemTypes/LinkableMenuItemType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Statikbe\FilamentFlexibleContentBlockPages\Form\Fields\Types;
3+
namespace Statikbe\FilamentFlexibleContentBlockPages\Form\Components\MenuItemTypes;
44

55
use Closure;
66
use Statikbe\FilamentFlexibleContentBlockPages\Models\Contracts\HasMenuLabel;

src/Form/Fields/Types/RouteMenuItemType.php renamed to src/Form/Components/MenuItemTypes/RouteMenuItemType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Statikbe\FilamentFlexibleContentBlockPages\Form\Fields\Types;
3+
namespace Statikbe\FilamentFlexibleContentBlockPages\Form\Components\MenuItemTypes;
44

55
use Filament\Forms\Components\Select;
66
use Illuminate\Support\Facades\Route;

src/Form/Fields/Types/UrlMenuItemType.php renamed to src/Form/Components/MenuItemTypes/UrlMenuItemType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Statikbe\FilamentFlexibleContentBlockPages\Form\Fields\Types;
3+
namespace Statikbe\FilamentFlexibleContentBlockPages\Form\Components\MenuItemTypes;
44

55
use Filament\Forms\Components\TextInput;
66

src/Form/Fields/LabelField.php renamed to src/Form/Components/MenuLabelField.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

3-
namespace Statikbe\FilamentFlexibleContentBlockPages\Form\Fields;
3+
namespace Statikbe\FilamentFlexibleContentBlockPages\Form\Components;
44

55
use Statikbe\FilamentFlexibleContentBlocks\Filament\Form\Fields\TitleField;
66

7-
class LabelField extends TitleField
7+
class MenuLabelField extends TitleField
88
{
99
const FIELD = 'label';
1010

0 commit comments

Comments
 (0)