Skip to content

Commit

Permalink
Merge pull request #1042 from creative-commoners/pulls/4.10/remove-field
Browse files Browse the repository at this point in the history
FIX Remove TopPageID from editable fields
  • Loading branch information
GuySartorelli authored Mar 3, 2023
2 parents 00840f6 + 758741f commit 6a71b65
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/TopPage/DataExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use SilverStripe\ORM\ValidationException;
use SilverStripe\Versioned\Versioned;
use SilverStripe\View\ViewableData;
use SilverStripe\Forms\FieldList;

/**
* Class DataExtension
Expand Down Expand Up @@ -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
*
Expand Down
7 changes: 7 additions & 0 deletions src/TopPage/FluentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\Queries\SQLUpdate;
use TractorCow\Fluent\State\FluentState;
use SilverStripe\Forms\FieldList;

/**
* Class FluentExtension
Expand All @@ -29,6 +30,12 @@ class FluentExtension extends DataExtension
'TopPageLocale' => 'Varchar',
];

public function updateCMSFields(FieldList $fields)
{
$fields->removeByName('TopPageID');
$fields->removeByName('TopPageLocale');
}

/*
* @inheritdoc
*/
Expand Down

0 comments on commit 6a71b65

Please sign in to comment.