diff --git a/CHANGELOG b/CHANGELOG index 005e671..db3f76b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,25 @@ # Changelog -## Version 4.1.1 +## Version 4.1.0 + +In our previous setup we told you can extend the `PageResource` to customize the flexible content +layouts. But this meant that the same 'page' resource was registered twice in Nova, which caused +several issues, like unable to customize global search behaviour. + +You can still extend the `PageResource` to customize the flexible content layouts, but you should +configure it in the `nova-pages-tool.php` config file: + +```php +'pageResourceClass' => \App\Nova\Page::class, +``` + +Update notes: In previous versions you had to disable the global search functionality on your extended +page resource, otherwise you got double search results. You can remove this disabling 'hack' now. + +## Version 4.0.1 - Use the `FRONTEND_URL` environment variable to configure which URL will be -used to link to pages. Useful when you're using Nova as a headless CMS. + used to link to pages. Useful when you're using Nova as a headless CMS. ## Version 4.0.0 diff --git a/README.md b/README.md index 0dda715..94ab6e9 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,9 @@ php artisan vendor:publish --provider="Grrr\Pages\ToolServiceProvider" --tag="co Out of the box you will get a Pages tool in your Nova back-end to manage pages. If everything is to your liking, you can just start using it as-is! -However, you will probably want to add some layouts to be used in the flexible-content portion of the page. -You can create your own `Page` resource and extend `Grrr\Pages\Resources\PageResource`. Override the `getFlexibleLayouts()` method to specify your own flexible content layouts: +However, you will probably want to add some layouts to be used in the flexible-content portion of the page. Or customize some other properties. + +In the configuration file `config/nova-pages-tool.php` you can tell it to use your own Nova resource and extend `Grrr\Pages\Resources\PageResource`. Override the `getFlexibleLayouts()` method to specify your own flexible content layouts: ```php namespace App\Nova; diff --git a/config/nova-pages-tool.php b/config/nova-pages-tool.php index ef627c7..2cf523a 100644 --- a/config/nova-pages-tool.php +++ b/config/nova-pages-tool.php @@ -10,6 +10,8 @@ // Disable for unilingual websites. 'allowTranslations' => true, + 'pageResourceClass' => \Grrr\Pages\Resources\PageResource::class, + 'templates' => [\Grrr\Pages\Models\Page::TEMPLATE_DEFAULT], 'defaultTemplate' => \Grrr\Pages\Models\Page::TEMPLATE_DEFAULT, diff --git a/src/PagesTool.php b/src/PagesTool.php index 3173c45..58a6079 100644 --- a/src/PagesTool.php +++ b/src/PagesTool.php @@ -17,7 +17,12 @@ class PagesTool extends Tool */ public function boot() { - Nova::resources([PageResource::class]); + // Only register default PageResource class when there is no custom one configured. + if ( + config('nova-pages-tool.pageResourceClass') === PageResource::class + ) { + Nova::resources([PageResource::class]); + } } /**