Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

API CHANGE Adjusting to split of SiteTree->getCMSFields() into getSet…

…tingsFields(), and new tab paths ("Root.Content" instead of "Root.Content.Main")
  • Loading branch information...
commit 583f669c680b76284eb8950be92403dce235c301 1 parent ba4d709
Ingo Schommer chillu authored
2  docs/en/reference/typography.md
View
@@ -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;
}
2  docs/en/topics/forms.md
View
@@ -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');
2  docs/en/topics/page-types.md
View
@@ -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;
}
2  docs/en/topics/widgets.md
View
@@ -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
........
18 docs/en/tutorials/2-extending-a-basic-site.md
View
@@ -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.
12 docs/en/tutorials/5-dataobject-relationship-management.md
View
@@ -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;
}
2  forms/DropdownField.php
View
@@ -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');
* </code>
*
* As you see, you need to put "GalleryID", rather than "Gallery" here.
2  forms/FieldGroup.php
View
@@ -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?")
10 tests/forms/FieldSetTest.php
View
@@ -213,7 +213,7 @@ function testNestedTabsFindingFieldByName() {
/* 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 @@ function testNestedTabsFindingFieldByName() {
$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 @@ function testNestedTabsFindingFieldByName() {
$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() {
Please sign in to comment.
Something went wrong with that request. Please try again.