Skip to content

Commit b648b7b

Browse files
committed
INTLAR-149: Replicate action disable in table
1 parent ec26f86 commit b648b7b

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ The package provides a comprehensive page management system built on flexible co
231231
- **Media management** - Hero images, content images, and SEO images via [Spatie Media Library](https://github.com/spatie/laravel-medialibrary)
232232
- **Template system** - Custom page templates with fallback support
233233
- **Protected pages** - Undeletable flag for critical pages
234+
- **Replicate pages** - Duplicate a page from the edit page or table (disable in config)
234235
- **Search & filtering** - Full-text search across page content, ready for [Laravel Scout](https://laravel.com/docs/12.x/scout)
235236

236237
### Creating Pages

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@
113113
*/
114114
'enable_undeletable' => true,
115115

116+
/*
117+
| Enable the replicate action on the table
118+
*/
119+
'enable_replicate_action_on_table' => false,
120+
116121
/*
117122
| The Filament navigation menu sorting order of the page resource
118123
*/

documentation/configuration.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ Configure various features and options for the page resource. These settings con
113113
// Enable undeletable flag to protect important pages
114114
'enable_undeletable' => true,
115115

116+
// Enable the feature for pages to have a boolean to make them undeletable
117+
'enable_replicate_action_on_table' => false,
118+
116119
// Navigation sorting order in Filament admin
117120
'navigation_sort' => 5,
118121
],
@@ -126,6 +129,7 @@ Configure various features and options for the page resource. These settings con
126129
- **enable_author**: Allows pages to have an assigned author from the users table
127130
- **enable_parent**: Enables hierarchical page structure with parent-child relationships
128131
- **enable_undeletable**: Adds a boolean field to protect important pages from deletion
132+
- **enable_replicate_action_on_table**: Shows the replicate action in the table
129133
- **navigation_sort**: Controls the order of the page resource in the Filament navigation menu
130134

131135
## CMS Panel Configuration

src/FilamentFlexibleContentBlockPagesConfig.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,14 @@ public function isUndeletableEnabled(string $modelClass): bool
333333
return $this->packageConfig("page_resource.{$modelClass}.enable_undeletable", true);
334334
}
335335

336+
/**
337+
* @param class-string<Model> $modelClass
338+
*/
339+
public function isReplicateActionOnTableEnabled(string $modelClass): bool
340+
{
341+
return $this->packageConfig("page_resource.{$modelClass}.enable_replicate_action_on_table", true);
342+
}
343+
336344
public function getPageNavigationSort(string $modelClass): ?int
337345
{
338346
return $this->packageConfig("page_resource.{$modelClass}.navigation_sort");

src/Resources/PageResource.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ public static function table(Table $table): Table
215215
PublishAction::make(),
216216
ViewAction::make(),
217217
ReplicateAction::make()
218+
->visible(FilamentFlexibleContentBlockPages::config()->isReplicateActionOnTableEnabled(static::getModel()))
218219
->successRedirectUrl(fn (ReplicateAction $action) => PageResource::getUrl('edit', ['record' => $action->getReplica()])),
219220
])
220221
->bulkActions([

0 commit comments

Comments
 (0)