diff --git a/docs/en/reference/typography.md b/docs/en/reference/typography.md index 1a448557e..a1795096a 100644 --- a/docs/en/reference/typography.md +++ b/docs/en/reference/typography.md @@ -97,7 +97,7 @@ This example sets another CSS class typographybis: ... $htmleditor = new HTMLEditorField("ContentBis", "Content Bis"); $htmleditor->setCSSClass('typographybis'); - $fields->addFieldToTab("Root.Content.Main", $htmleditor); + $fields->addFieldToTab("Root.Content", $htmleditor); ... return $fields; } diff --git a/docs/en/topics/forms.md b/docs/en/topics/forms.md index 40bdcc577..6cd2146cf 100644 --- a/docs/en/topics/forms.md +++ b/docs/en/topics/forms.md @@ -267,7 +267,7 @@ If you want to remove certain fields from your subclass: Adds a new text field called FavouriteColour next to the Content field in the CMS :::php - $fields->addFieldToTab('Root.Content.Main', new TextField('FavouriteColour'), 'Content'); + $fields->addFieldToTab('Root.Content', new TextField('FavouriteColour'), 'Content'); diff --git a/docs/en/topics/page-types.md b/docs/en/topics/page-types.md index 3fc936413..83b377283 100644 --- a/docs/en/topics/page-types.md +++ b/docs/en/topics/page-types.md @@ -86,7 +86,7 @@ want the MenuTitle field to show on your page, which is inherited from `[api:Sit function getCMSFields() { $fields = parent::getCMSFields(); - $fields->removeFieldFromTab('Root.Content.Main', 'MenuTitle'); + $fields->removeFieldFromTab('Root.Content', 'MenuTitle'); return $fields; } diff --git a/docs/en/topics/widgets.md b/docs/en/topics/widgets.md index 0b0ba3bbb..0f18c5c7a 100644 --- a/docs/en/topics/widgets.md +++ b/docs/en/topics/widgets.md @@ -297,7 +297,7 @@ Page class). One way to fix this is to comment out line 30 in BlogHolder.php and ....... function getCMSFields() { $fields = parent::getCMSFields(); - $fields->removeFieldFromTab("Root.Content.Main","Content"); + $fields->removeFieldFromTab("Root.Content","Content"); // $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("SideBar")); COMMENT OUT ........ diff --git a/docs/en/tutorials/2-extending-a-basic-site.md b/docs/en/tutorials/2-extending-a-basic-site.md index 046162cfe..4c4a712c5 100644 --- a/docs/en/tutorials/2-extending-a-basic-site.md +++ b/docs/en/tutorials/2-extending-a-basic-site.md @@ -174,8 +174,8 @@ method to the *ArticlePage* class. function getCMSFields() { $fields = parent::getCMSFields(); - $fields->addFieldToTab('Root.Content.Main', new DateField('Date'), 'Content'); - $fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content'); + $fields->addFieldToTab('Root.Content', new DateField('Date'), 'Content'); + $fields->addFieldToTab('Root.Content', new TextField('Author'), 'Content'); return $fields; } @@ -195,12 +195,12 @@ Firstly, we get the fields from the parent class; we want to add fields, not rep returned is a `[api:FieldSet]` object. :::php - $fields->addFieldToTab('Root.Content.Main', new DateField('Date'), 'Content'); - $fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content'); + $fields->addFieldToTab('Root.Content', new DateField('Date'), 'Content'); + $fields->addFieldToTab('Root.Content', new TextField('Author'), 'Content'); We can then add our new fields with *addFieldToTab*. The first argument is the tab on which we want to add the field to: -"Root.Content.Main" is the tab which the content editor is on. The second argument is the field to add; this is not a +"Root.Content" is the tab which the content editor is on. The second argument is the field to add; this is not a database field, but a `[api:FormField]` documentation for more details. :::php @@ -232,11 +232,11 @@ To make the date field a bit more user friendly, you can add a dropdown calendar function getCMSFields() { $fields = parent::getCMSFields(); - $fields->addFieldToTab('Root.Content.Main', $dateField = new DateField('Date','Article Date (for example: 20/12/2010)'), 'Content'); + $fields->addFieldToTab('Root.Content', $dateField = new DateField('Date','Article Date (for example: 20/12/2010)'), 'Content'); $dateField->setConfig('showcalendar', true); $dateField->setConfig('dateformat', 'dd/MM/YYYY'); - $fields->addFieldToTab('Root.Content.Main', new TextField('Author','Author Name'), 'Content'); + $fields->addFieldToTab('Root.Content', new TextField('Author','Author Name'), 'Content'); return $fields; } @@ -244,7 +244,7 @@ To make the date field a bit more user friendly, you can add a dropdown calendar Let's walk through these changes. :::php - $fields->addFieldToTab('Root.Content.Main', $dateField = new DateField('Date','Article Date (for example: 20/12/2010)'), 'Content'); + $fields->addFieldToTab('Root.Content', $dateField = new DateField('Date','Article Date (for example: 20/12/2010)'), 'Content'); *$dateField* is added only to the DateField in order to change the configuration. @@ -259,7 +259,7 @@ Set *showCalendar* to true to have a calendar appear underneath the Date field w *dateFormat* allows you to specify how you wish the date to be entered and displayed in the CMS field. :::php - $fields->addFieldToTab('Root.Content.Main', new TextField('Author','Author Name'), 'Content'); + $fields->addFieldToTab('Root.Content', new TextField('Author','Author Name'), 'Content'); By default the first argument *'Date'* or *'Author'* is shown as the title, however this might not be that helpful so to change the title, add the new title as the second argument. See the `[api:DateField]` documentation for more details. diff --git a/docs/en/tutorials/5-dataobject-relationship-management.md b/docs/en/tutorials/5-dataobject-relationship-management.md index dcd633756..9c7cd52e0 100644 --- a/docs/en/tutorials/5-dataobject-relationship-management.md +++ b/docs/en/tutorials/5-dataobject-relationship-management.md @@ -135,7 +135,7 @@ The second step is to add the table in the method *getCMSFields* which will allo ); $tablefield->setParentClass('Project'); - $fields->addFieldToTab( 'Root.Content.Student', $tablefield ); + $fields->addFieldToTab( 'Root.Student', $tablefield ); return $fields; } @@ -259,9 +259,9 @@ The first step is to create the mentor object and set the relation with the *Stu function getCMSFields() { $fields = parent::getCMSFields(); - $fields->addFieldToTab( 'Root.Content.Main', new TextField( 'FirstName' ) ); - $fields->addFieldToTab( 'Root.Content.Main', new TextField( 'Lastname' ) ); - $fields->addFieldToTab( 'Root.Content.Main', new TextField( 'Nationality' ) ); + $fields->addFieldToTab( 'Root.Content', new TextField( 'FirstName' ) ); + $fields->addFieldToTab( 'Root.Content', new TextField( 'Lastname' ) ); + $fields->addFieldToTab( 'Root.Content', new TextField( 'Nationality' ) ); return $fields; } @@ -313,7 +313,7 @@ The second step is to add the table in the method *getCMSFields* which will allo ); $tablefield->setAddTitle( 'A Student' ); - $fields->addFieldToTab( 'Root.Content.Students', $tablefield ); + $fields->addFieldToTab( 'Root.Students', $tablefield ); return $fields; } @@ -429,7 +429,7 @@ relation. ); $modulesTablefield->setAddTitle( 'A Module' ); - $fields->addFieldToTab( 'Root.Content.Modules', $modulesTablefield ); + $fields->addFieldToTab( 'Root.Modules', $modulesTablefield ); return $fields; } diff --git a/forms/DropdownField.php b/forms/DropdownField.php index 8f0a43a6d..c87a95cfc 100755 --- a/forms/DropdownField.php +++ b/forms/DropdownField.php @@ -17,7 +17,7 @@ * if ($galleries) { * $galleries = $galleries->toDropdownMap('ID', 'Title', '(Select one)', true); * } - * $fields->addFieldToTab('Root.Content.Main', new DropdownField('GalleryID', 'Gallery', $galleries), 'Content'); + * $fields->addFieldToTab('Root.Content', new DropdownField('GalleryID', 'Gallery', $galleries), 'Content'); * * * As you see, you need to put "GalleryID", rather than "Gallery" here. diff --git a/forms/FieldGroup.php b/forms/FieldGroup.php index 1090d05f7..6d5a5ab37 100755 --- a/forms/FieldGroup.php +++ b/forms/FieldGroup.php @@ -28,7 +28,7 @@ * $fields = parent::getCMSFields(); * * $fields->addFieldToTab( - * 'Root.Content.Main', + * 'Root.Content', * new FieldGroup( * new TimeField("StartTime","What's the start time?"), * new TimeField("EndTime","What's the end time?") diff --git a/tests/forms/FieldSetTest.php b/tests/forms/FieldSetTest.php index 70914ab7c..c01bf7372 100644 --- a/tests/forms/FieldSetTest.php +++ b/tests/forms/FieldSetTest.php @@ -213,7 +213,7 @@ class FieldSetTest extends SapphireTest { /* 2 tabs get created within a TabSet inside our set */ $tab = new TabSet('Root', - new TabSet('Content', + new TabSet('MyContent', $mainTab = new Tab('Main'), $otherTab = new Tab('Others') ) @@ -221,8 +221,8 @@ class FieldSetTest extends SapphireTest { $fields->push($tab); /* Some fields get added to the 2 tabs we just created */ - $fields->addFieldToTab('Root.Content.Main', new TextField('Country')); - $fields->addFieldToTab('Root.Content.Others', new TextField('Email')); + $fields->addFieldToTab('Root.MyContent.Main', new TextField('Country')); + $fields->addFieldToTab('Root.MyContent.Others', new TextField('Email')); /* The fields we just added actually exists in the set */ $this->assertNotNull($fields->dataFieldByName('Country')); @@ -236,8 +236,8 @@ class FieldSetTest extends SapphireTest { $this->assertEquals(1, $mainTab->Fields()->Count()); $this->assertEquals(1, $otherTab->Fields()->Count()); - $this->assertNotNull($fields->fieldByName('Root.Content')); - $this->assertNotNull($fields->fieldByName('Root.Content.Main')); + $this->assertNotNull($fields->fieldByName('Root.MyContent')); + $this->assertNotNull($fields->fieldByName('Root.MyContent')); } function testTabTitles() {