Skip to content

Commit

Permalink
FIX Set RelatedPages gridfield to be structural
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jun 12, 2024
1 parent b26fdaf commit 661bfe9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/PageTypes/BasePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Symbiote\GridFieldExtensions\GridFieldOrderableRows;
use TractorCow\Fluent\Model\Locale;
use TractorCow\Fluent\State\FluentState;
use SilverStripe\Forms\FormField;

/**
* `BasePage` is a foundation page class which can be used for constructing your own page types. By default it is
Expand Down Expand Up @@ -129,12 +130,16 @@ public function getCMSFields()
);
$fields->addFieldToTab(
'Root.RelatedPages',
GridField::create(
// Use an anonymous class to set $schemaDataType so that this field
// does not throw an exception in a react context e.g. versioned-admin
new class (
'RelatedPages',
_t(__CLASS__ . '.RelatedPages', 'Related pages'),
$this->RelatedPagesThrough(),
$components
)
) extends GridField {
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_STRUCTURAL;
}
);

// Taxonomies - Unless they have their own 'Tags' field (such as in Blog, etc)
Expand Down

0 comments on commit 661bfe9

Please sign in to comment.