mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fix issue with the GridField documenation - many_many_extraFields code example
This commit is contained in:
parent
f77f725355
commit
d6fc7fe804
@ -329,6 +329,7 @@ The namespace notation is `ManyMany[<extradata-field-name>]`, so for example `Ma
|
||||
use SilverStripe\Forms\TextField;
|
||||
use SilverStripe\Forms\GridField\GridField;
|
||||
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor;
|
||||
use SilverStripe\Forms\GridField\GridFieldDetailForm;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
|
||||
class Team extends DataObject
|
||||
@ -338,7 +339,7 @@ class Team extends DataObject
|
||||
'Name' => 'Text'
|
||||
];
|
||||
|
||||
public static $many_many = [
|
||||
public static $belongs_many_many = [
|
||||
'Players' => 'Player'
|
||||
];
|
||||
}
|
||||
@ -372,7 +373,7 @@ class Player extends DataObject
|
||||
);
|
||||
|
||||
$config = GridFieldConfig_RelationEditor::create();
|
||||
$config->getComponentByType('GridFieldDetailForm')->setFields($teamFields);
|
||||
$config->getComponentByType(GridFieldDetailForm::class)->setFields($teamFields);
|
||||
|
||||
$gridField = new GridField('Teams', 'Teams', $this->Teams(), $config);
|
||||
$fields->findOrMakeTab('Root.Teams')->replaceField('Teams', $gridField);
|
||||
|
Loading…
Reference in New Issue
Block a user