Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

API CHANGE Removed $params argument to DataObject->getCMSFields(), pl…

…ease use FormScaffolder directly (fixes #7135)
  • Loading branch information...
commit 8ba9c3ca6b468ffb3206856bd658a3a8269b32a8 1 parent 0f8a699
@chillu chillu authored
View
4 docs/en/changelogs/3.0.0.md
@@ -226,6 +226,10 @@ in the "Behaviour" or "Access" tab, please move these customizations to a new `g
In case of SiteTree extension through `updateCMSFields()` and a decorator/extension,
please use the new `updateSettingsFields()` instead.
+We've also removed the `$params` attribute on `DataObject->getCMSFields()`
+which could be used as a shortcut for customizations to `FormScaffolder`,
+in order to achieve E_STRICT compliance. Please use `FormScaffolder` directly.
+
### New `SiteTree::$description` field to describe purpose of a page type ###
Please use this static property to describe the purpose of your page types,
View
2  filesystem/File.php
@@ -321,7 +321,7 @@ function canDelete($member = null) {
*
* @return FieldList
*/
- function getCMSFields($params = null) {
+ function getCMSFields() {
// Preview
if($this instanceof Image) {
$formattedImage = $this->getFormattedImage('SetWidth', Image::$asset_preview_width);
View
2  filesystem/Folder.php
@@ -406,7 +406,7 @@ public function updateFilesystem() {
* You can modify this FieldList by subclassing folder, or by creating a {@link DataExtension}
* and implemeting updateCMSFields(FieldList $fields) on that extension.
*/
- function getCMSFields($param = null) {
+ function getCMSFields() {
// Hide field on root level, which can't be renamed
if(!$this->ID || $this->ID === "root") {
$titleField = new HiddenField("Name");
View
16 model/DataObject.php
@@ -1837,18 +1837,14 @@ public function scaffoldFormFields($_params = null) {
*
* @see Good example of complex FormField building: SiteTree::getCMSFields()
*
- * @param array $params See {@link scaffoldFormFields()}
* @return FieldList Returns a TabSet for usage within the CMS - don't use for frontend forms.
*/
- public function getCMSFields($params = null) {
- $tabbedFields = $this->scaffoldFormFields(array_merge(
- array(
- // Don't allow has_many/many_many relationship editing before the record is first saved
- 'includeRelations' => ($this->ID > 0),
- 'tabbed' => true,
- 'ajaxSafe' => true
- ),
- (array)$params
+ public function getCMSFields() {
+ $tabbedFields = $this->scaffoldFormFields(array(
+ // Don't allow has_many/many_many relationship editing before the record is first saved
+ 'includeRelations' => ($this->ID > 0),
+ 'tabbed' => true,
+ 'ajaxSafe' => true
));
$this->extend('updateCMSFields', $tabbedFields);
View
4 model/Image.php
@@ -73,8 +73,8 @@ public function defineMethods() {
parent::defineMethods();
}
- function getCMSFields($params = null) {
- $fields = parent::getCMSFields($params);
+ function getCMSFields() {
+ $fields = parent::getCMSFields();
$urlLink = "<div class='field readonly'>";
$urlLink .= "<label class='left'>"._t('AssetTableField.URL','URL')."</label>";
View
2  security/Group.php
@@ -59,7 +59,7 @@ function getAllChildren() {
*
* @return FieldList
*/
- public function getCMSFields($params = null) {
+ public function getCMSFields() {
Requirements::javascript(SAPPHIRE_DIR . '/javascript/PermissionCheckboxSetField.js');
$fields = new FieldList(
View
2  security/Member.php
@@ -1084,7 +1084,7 @@ public function memberNotInGroups($groupList, $memberGroups = null){
* @return FieldList Return a FieldList of fields that would appropriate for
* editing this member.
*/
- public function getCMSFields($params = null) {
+ public function getCMSFields() {
require_once('Zend/Date.php');
$fields = parent::getCMSFields();
View
4 security/PermissionRole.php
@@ -33,8 +33,8 @@ class PermissionRole extends DataObject {
static $plural_name = 'Roles';
- function getCMSFields($params = null) {
- $fields = parent::getCMSFields($params);
+ function getCMSFields() {
+ $fields = parent::getCMSFields();
$fields->removeFieldFromTab('Root', 'Codes');
$fields->removeFieldFromTab('Root', 'Groups');
View
12 tests/forms/gridfield/GridFieldDetailFormTest.php
@@ -143,8 +143,8 @@ class GridFieldDetailFormTest_Person extends DataObject implements TestOnly {
'Categories' => 'GridFieldDetailFormTest_Category'
);
- function getCMSFields($params = null) {
- $fields = parent::getCMSFields($params);
+ function getCMSFields() {
+ $fields = parent::getCMSFields();
// TODO No longer necessary once FormScaffolder uses GridField
$fields->replaceField('Categories',
GridField::create('Categories', 'Categories',
@@ -165,8 +165,8 @@ class GridFieldDetailFormTest_PeopleGroup extends DataObject implements TestOnly
'People' => 'GridFieldDetailFormTest_Person'
);
- function getCMSFields($params = null) {
- $fields = parent::getCMSFields($params);
+ function getCMSFields() {
+ $fields = parent::getCMSFields();
// TODO No longer necessary once FormScaffolder uses GridField
$fields->replaceField('People',
GridField::create('People', 'People',
@@ -187,8 +187,8 @@ class GridFieldDetailFormTest_Category extends DataObject implements TestOnly {
'People' => 'GridFieldDetailFormTest_Person'
);
- function getCMSFields($params = null) {
- $fields = parent::getCMSFields($params);
+ function getCMSFields() {
+ $fields = parent::getCMSFields();
// TODO No longer necessary once FormScaffolder uses GridField
$fields->replaceField('People',
GridField::create('People', 'People',
View
4 tests/model/DataDifferencerTest.php
@@ -62,8 +62,8 @@ class DataDifferencerTest_Object extends DataObject implements TestOnly {
'HasOneRelation' => 'DataDifferencerTest_HasOneRelationObject'
);
- function getCMSFields($params = null) {
- $fields = parent::getCMSFields($params);
+ function getCMSFields() {
+ $fields = parent::getCMSFields();
$choices = array(
'a' => 'a',
'b' => 'b',
View
2  tests/security/GroupTest.php
@@ -136,7 +136,7 @@ public function testDelete() {
class GroupTest_Member extends Member implements TestOnly {
- function getCMSFields($params = null) {
+ function getCMSFields() {
$groups = DataObject::get('Group');
$groupsMap = ($groups) ? $groups->map() : false;
$fields = new FieldList(
Please sign in to comment.
Something went wrong with that request. Please try again.