From 46891b2dead9925e587f7d822480aa0345944b56 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 6 Jul 2017 14:25:33 +1200 Subject: [PATCH] Ownership on GridFieldTestPage --- code/GridFieldTestPage.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/code/GridFieldTestPage.php b/code/GridFieldTestPage.php index b981a68..0c8c8cd 100644 --- a/code/GridFieldTestPage.php +++ b/code/GridFieldTestPage.php @@ -24,6 +24,11 @@ class GridFieldTestPage extends TestPage "ManyManyCompanies" => "SilverStripe\\FrameworkTest\\Model\\Company", ); + private static $owns = [ + 'HasOneCompany', + 'HasManyCompanies', + ]; + public function getCMSFields() { $fields = parent::getCMSFields(); @@ -32,25 +37,22 @@ class GridFieldTestPage extends TestPage $config = new GridFieldConfig_RecordEditor(); $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); $grids[] = $grid; $config = new GridFieldConfig_RelationEditor(); $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); $grids[] = $grid; $config = new GridFieldConfig_RelationEditor(); $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); $grids[] = $grid; - foreach ($grids as $grid) { - $grid - ->setDescription('This is bold help text'); - // ->addExtraClass('cms-description-tooltip'); - } - return $fields; } }