mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
Ownership on GridFieldTestPage
This commit is contained in:
parent
d2711a82bb
commit
46891b2dea
@ -24,6 +24,11 @@ class GridFieldTestPage extends TestPage
|
|||||||
"ManyManyCompanies" => "SilverStripe\\FrameworkTest\\Model\\Company",
|
"ManyManyCompanies" => "SilverStripe\\FrameworkTest\\Model\\Company",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private static $owns = [
|
||||||
|
'HasOneCompany',
|
||||||
|
'HasManyCompanies',
|
||||||
|
];
|
||||||
|
|
||||||
public function getCMSFields()
|
public function getCMSFields()
|
||||||
{
|
{
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
@ -32,25 +37,22 @@ class GridFieldTestPage extends TestPage
|
|||||||
|
|
||||||
$config = new GridFieldConfig_RecordEditor();
|
$config = new GridFieldConfig_RecordEditor();
|
||||||
$grid = new GridField('Companies', 'Companies', new DataList('SilverStripe\\FrameworkTest\\Model\\Company'), $config);
|
$grid = new GridField('Companies', 'Companies', new DataList('SilverStripe\\FrameworkTest\\Model\\Company'), $config);
|
||||||
|
$grid->setDescription('Records are NOT owned by the page, and need to be individually published');
|
||||||
$fields->addFieldToTab('Root.NoRelation', $grid);
|
$fields->addFieldToTab('Root.NoRelation', $grid);
|
||||||
$grids[] = $grid;
|
$grids[] = $grid;
|
||||||
|
|
||||||
$config = new GridFieldConfig_RelationEditor();
|
$config = new GridFieldConfig_RelationEditor();
|
||||||
$grid = new GridField('HasManyCompanies', 'HasManyCompanies', $this->HasManyCompanies(), $config);
|
$grid = new GridField('HasManyCompanies', 'HasManyCompanies', $this->HasManyCompanies(), $config);
|
||||||
|
$grid->setDescription('Records are owned by the page, so should auto-publish');
|
||||||
$fields->addFieldToTab('Root.HasMany', $grid);
|
$fields->addFieldToTab('Root.HasMany', $grid);
|
||||||
$grids[] = $grid;
|
$grids[] = $grid;
|
||||||
|
|
||||||
$config = new GridFieldConfig_RelationEditor();
|
$config = new GridFieldConfig_RelationEditor();
|
||||||
$grid = new GridField('ManyManyCompanies', 'ManyManyCompanies', $this->ManyManyCompanies(), $config);
|
$grid = new GridField('ManyManyCompanies', 'ManyManyCompanies', $this->ManyManyCompanies(), $config);
|
||||||
|
$grid->setDescription('Records are NOT owned by the page, and need to be individually published');
|
||||||
$fields->addFieldToTab('Root.ManyMany', $grid);
|
$fields->addFieldToTab('Root.ManyMany', $grid);
|
||||||
$grids[] = $grid;
|
$grids[] = $grid;
|
||||||
|
|
||||||
foreach ($grids as $grid) {
|
|
||||||
$grid
|
|
||||||
->setDescription('This is <strong>bold</strong> help text');
|
|
||||||
// ->addExtraClass('cms-description-tooltip');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user