From 758741f206c4b157f36c6b8166ed66217dc63d59 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 2 Mar 2023 18:09:20 +1300 Subject: [PATCH] FIX Remove TopPageID from editable fields --- src/TopPage/DataExtension.php | 6 ++++++ src/TopPage/FluentExtension.php | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/TopPage/DataExtension.php b/src/TopPage/DataExtension.php index c4c5d117..751c5f8d 100644 --- a/src/TopPage/DataExtension.php +++ b/src/TopPage/DataExtension.php @@ -12,6 +12,7 @@ use SilverStripe\ORM\ValidationException; use SilverStripe\Versioned\Versioned; use SilverStripe\View\ViewableData; +use SilverStripe\Forms\FieldList; /** * Class DataExtension @@ -255,6 +256,11 @@ public function withFixedTopPage(int $topPageID, callable $callback) } } + public function updateCMSFields(FieldList $fields) + { + $fields->removeByName('TopPageID'); + } + /** * Get the ID of a page which is currently set as the fixed top page * diff --git a/src/TopPage/FluentExtension.php b/src/TopPage/FluentExtension.php index 1961f044..8b88149e 100644 --- a/src/TopPage/FluentExtension.php +++ b/src/TopPage/FluentExtension.php @@ -8,6 +8,7 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\Queries\SQLUpdate; use TractorCow\Fluent\State\FluentState; +use SilverStripe\Forms\FieldList; /** * Class FluentExtension @@ -29,6 +30,12 @@ class FluentExtension extends DataExtension 'TopPageLocale' => 'Varchar', ]; + public function updateCMSFields(FieldList $fields) + { + $fields->removeByName('TopPageID'); + $fields->removeByName('TopPageLocale'); + } + /* * @inheritdoc */