Skip to content
This repository
Browse code

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

…ease use FormScaffolder directly (fixes #7135)
  • Loading branch information...
commit 8ba9c3ca6b468ffb3206856bd658a3a8269b32a8 1 parent 0f8a699
Ingo Schommer authored April 13, 2012
4  docs/en/changelogs/3.0.0.md
Source Rendered
@@ -226,6 +226,10 @@ in the "Behaviour" or "Access" tab, please move these customizations to a new `g
226 226
 In case of SiteTree extension through `updateCMSFields()` and a decorator/extension,
227 227
 please use the new `updateSettingsFields()` instead.
228 228
 
  229
+We've also removed the `$params` attribute on `DataObject->getCMSFields()`
  230
+which could be used as a shortcut for customizations to `FormScaffolder`,
  231
+in order to achieve E_STRICT compliance. Please use `FormScaffolder` directly.
  232
+
229 233
 ### New `SiteTree::$description` field to describe purpose of a page type ###
230 234
 
231 235
 Please use this static property to describe the purpose of your page types,
2  filesystem/File.php
@@ -321,7 +321,7 @@ function canDelete($member = null) {
321 321
 	 * 
322 322
 	 * @return FieldList
323 323
 	 */
324  
-	function getCMSFields($params = null) {
  324
+	function getCMSFields() {
325 325
 		// Preview
326 326
 		if($this instanceof Image) {
327 327
 			$formattedImage = $this->getFormattedImage('SetWidth', Image::$asset_preview_width);
2  filesystem/Folder.php
@@ -406,7 +406,7 @@ public function updateFilesystem() {
406 406
 	 * You can modify this FieldList by subclassing folder, or by creating a {@link DataExtension}
407 407
 	 * and implemeting updateCMSFields(FieldList $fields) on that extension.
408 408
 	 */
409  
-	function getCMSFields($param = null) {
  409
+	function getCMSFields() {
410 410
 		// Hide field on root level, which can't be renamed
411 411
 		if(!$this->ID || $this->ID === "root") {
412 412
 			$titleField = new HiddenField("Name");	
16  model/DataObject.php
@@ -1837,18 +1837,14 @@ public function scaffoldFormFields($_params = null) {
1837 1837
 	 *
1838 1838
 	 * @see Good example of complex FormField building: SiteTree::getCMSFields()
1839 1839
 	 *
1840  
-	 * @param array $params See {@link scaffoldFormFields()}
1841 1840
 	 * @return FieldList Returns a TabSet for usage within the CMS - don't use for frontend forms.
1842 1841
 	 */
1843  
-	public function getCMSFields($params = null) {
1844  
-		$tabbedFields = $this->scaffoldFormFields(array_merge(
1845  
-			array(
1846  
-				// Don't allow has_many/many_many relationship editing before the record is first saved
1847  
-				'includeRelations' => ($this->ID > 0),
1848  
-				'tabbed' => true,
1849  
-				'ajaxSafe' => true
1850  
-			),
1851  
-			(array)$params
  1842
+	public function getCMSFields() {
  1843
+		$tabbedFields = $this->scaffoldFormFields(array(
  1844
+			// Don't allow has_many/many_many relationship editing before the record is first saved
  1845
+			'includeRelations' => ($this->ID > 0),
  1846
+			'tabbed' => true,
  1847
+			'ajaxSafe' => true
1852 1848
 		));
1853 1849
 		
1854 1850
 		$this->extend('updateCMSFields', $tabbedFields);
4  model/Image.php
@@ -73,8 +73,8 @@ public function defineMethods() {
73 73
 		parent::defineMethods();
74 74
 	}
75 75
 
76  
-	function getCMSFields($params = null) {
77  
-		$fields = parent::getCMSFields($params);
  76
+	function getCMSFields() {
  77
+		$fields = parent::getCMSFields();
78 78
 
79 79
 		$urlLink = "<div class='field readonly'>";
80 80
 		$urlLink .= "<label class='left'>"._t('AssetTableField.URL','URL')."</label>";
2  security/Group.php
@@ -59,7 +59,7 @@ function getAllChildren() {
59 59
 	 *
60 60
 	 * @return FieldList
61 61
 	 */
62  
-	public function getCMSFields($params = null) {
  62
+	public function getCMSFields() {
63 63
 		Requirements::javascript(SAPPHIRE_DIR . '/javascript/PermissionCheckboxSetField.js');
64 64
 		
65 65
 		$fields = new FieldList(
2  security/Member.php
@@ -1084,7 +1084,7 @@ public function memberNotInGroups($groupList, $memberGroups = null){
1084 1084
 	 * @return FieldList Return a FieldList of fields that would appropriate for
1085 1085
 	 *                  editing this member.
1086 1086
 	 */
1087  
-	public function getCMSFields($params = null) {
  1087
+	public function getCMSFields() {
1088 1088
 		require_once('Zend/Date.php');
1089 1089
 		
1090 1090
 		$fields = parent::getCMSFields();
4  security/PermissionRole.php
@@ -33,8 +33,8 @@ class PermissionRole extends DataObject {
33 33
 
34 34
 	static $plural_name = 'Roles';
35 35
 	
36  
-	function getCMSFields($params = null) {
37  
-		$fields = parent::getCMSFields($params);
  36
+	function getCMSFields() {
  37
+		$fields = parent::getCMSFields();
38 38
 		
39 39
 		$fields->removeFieldFromTab('Root', 'Codes');
40 40
 		$fields->removeFieldFromTab('Root', 'Groups');
12  tests/forms/gridfield/GridFieldDetailFormTest.php
@@ -143,8 +143,8 @@ class GridFieldDetailFormTest_Person extends DataObject implements TestOnly {
143 143
 		'Categories' => 'GridFieldDetailFormTest_Category'
144 144
 	);
145 145
 
146  
-	function getCMSFields($params = null) {
147  
-		$fields = parent::getCMSFields($params);
  146
+	function getCMSFields() {
  147
+		$fields = parent::getCMSFields();
148 148
 		// TODO No longer necessary once FormScaffolder uses GridField
149 149
 		$fields->replaceField('Categories',
150 150
 			GridField::create('Categories', 'Categories',
@@ -165,8 +165,8 @@ class GridFieldDetailFormTest_PeopleGroup extends DataObject implements TestOnly
165 165
 		'People' => 'GridFieldDetailFormTest_Person'
166 166
 	);
167 167
 	
168  
-	function getCMSFields($params = null) {
169  
-		$fields = parent::getCMSFields($params);
  168
+	function getCMSFields() {
  169
+		$fields = parent::getCMSFields();
170 170
 		// TODO No longer necessary once FormScaffolder uses GridField
171 171
 		$fields->replaceField('People',
172 172
 			GridField::create('People', 'People',
@@ -187,8 +187,8 @@ class GridFieldDetailFormTest_Category extends DataObject implements TestOnly {
187 187
 		'People' => 'GridFieldDetailFormTest_Person'
188 188
 	);
189 189
 
190  
-	function getCMSFields($params = null) {
191  
-		$fields = parent::getCMSFields($params);
  190
+	function getCMSFields() {
  191
+		$fields = parent::getCMSFields();
192 192
 		// TODO No longer necessary once FormScaffolder uses GridField
193 193
 		$fields->replaceField('People',
194 194
 			GridField::create('People', 'People',
4  tests/model/DataDifferencerTest.php
@@ -62,8 +62,8 @@ class DataDifferencerTest_Object extends DataObject implements TestOnly {
62 62
 		'HasOneRelation' => 'DataDifferencerTest_HasOneRelationObject'
63 63
 	);
64 64
 	
65  
-	function getCMSFields($params = null) {
66  
-		$fields = parent::getCMSFields($params);
  65
+	function getCMSFields() {
  66
+		$fields = parent::getCMSFields();
67 67
 		$choices = array(
68 68
 			'a' => 'a',
69 69
 			'b' => 'b',
2  tests/security/GroupTest.php
@@ -136,7 +136,7 @@ public function testDelete() {
136 136
 
137 137
 class GroupTest_Member extends Member implements TestOnly {
138 138
    
139  
-   function getCMSFields($params = null) {
  139
+   function getCMSFields() {
140 140
       $groups = DataObject::get('Group');
141 141
       $groupsMap = ($groups) ? $groups->map() : false;
142 142
       $fields = new FieldList(

0 notes on commit 8ba9c3c

Please sign in to comment.
Something went wrong with that request. Please try again.