|
17 | 17 | use Symbiote\GridFieldExtensions\GridFieldOrderableRows; |
18 | 18 | use TractorCow\Fluent\Model\Locale; |
19 | 19 | use TractorCow\Fluent\State\FluentState; |
| 20 | +use SilverStripe\Forms\FormField; |
20 | 21 |
|
21 | 22 | /** |
22 | 23 | * `BasePage` is a foundation page class which can be used for constructing your own page types. By default it is |
@@ -127,15 +128,22 @@ public function getCMSFields() |
127 | 128 | 'Root.RelatedPages', |
128 | 129 | _t(__CLASS__ . '.RelatedPages', 'Related pages') |
129 | 130 | ); |
130 | | - $fields->addFieldToTab( |
131 | | - 'Root.RelatedPages', |
132 | | - GridField::create( |
133 | | - 'RelatedPages', |
134 | | - _t(__CLASS__ . '.RelatedPages', 'Related pages'), |
135 | | - $this->RelatedPagesThrough(), |
136 | | - $components |
137 | | - ) |
138 | | - ); |
| 131 | + $args = [ |
| 132 | + 'RelatedPages', |
| 133 | + _t(__CLASS__ . '.RelatedPages', 'Related pages'), |
| 134 | + $this->RelatedPagesThrough(), |
| 135 | + $components |
| 136 | + ]; |
| 137 | + $gridField = GridField::create(...$args); |
| 138 | + // If GridField has been replaced by Injector, use that |
| 139 | + // Otherwise use anonymous class so that versioned-admin behat tests pass |
| 140 | + // when running in kitchen-sink |
| 141 | + if (get_class($gridField) === GridField::class) { |
| 142 | + $gridField = new class (...$args) extends GridField { |
| 143 | + protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_STRUCTURAL; |
| 144 | + }; |
| 145 | + } |
| 146 | + $fields->addFieldToTab('Root.RelatedPages', $gridField); |
139 | 147 |
|
140 | 148 | // Taxonomies - Unless they have their own 'Tags' field (such as in Blog, etc) |
141 | 149 | $hasMany = $this->hasMany(); |
|
0 commit comments