Skip to content
This repository
Browse code

API CHANGE: GridFieldConfig should extend object to make use of Objec…

…t::create() this also fixes GridFieldConfig_RecordViewer::create() which was not working before

but don't extend Object
  • Loading branch information...
commit 70b22fa4cacc5e4978f9599a7d80b61d4e9589cd 1 parent c738744
authored sminnee committed

Showing 1 changed file with 10 additions and 38 deletions. Show diff stats Hide diff stats

  1. 48  forms/gridfield/GridFieldConfig.php
48  forms/gridfield/GridFieldConfig.php
@@ -14,20 +14,22 @@
14 14
  * - {@link GridFieldConfig_RelationEditor}
15 15
  */
16 16
 class GridFieldConfig {
17  
-	
18 17
 	/**
19 18
 	 *
20  
-	 * @return GridFieldConfig 
  19
+	 * @var ArrayList
21 20
 	 */
22  
-	public static function create(){
23  
-		return new GridFieldConfig();
24  
-	}
  21
+	protected $components = null;
25 22
 	
26 23
 	/**
27  
-	 *
28  
-	 * @var ArrayList
  24
+	 * @param mixed $arguments,... arguments to pass to the constructor
  25
+	 * @return GridFieldConfig
29 26
 	 */
30  
-	protected $components = null;
  27
+	public static function create() {
  28
+		return call_user_func_array('Object::create', array_merge(
  29
+			array(get_called_class()), 
  30
+			func_get_args()
  31
+		));
  32
+	}
31 33
 	
32 34
 	/**
33 35
 	 * 
@@ -131,16 +133,6 @@ public function getComponentByType($type) {
131 133
  * with sortable and searchable headers.
132 134
  */
133 135
 class GridFieldConfig_Base extends GridFieldConfig {
134  
-
135  
-	/**
136  
-	 *
137  
-	 * @param int $itemsPerPage - How many items per page should show up per page
138  
-	 * @return GridFieldConfig_Base
139  
-	 */
140  
-	public static function create($itemsPerPage=null){
141  
-		return new GridFieldConfig_Base($itemsPerPage);
142  
-	}
143  
-
144 136
 	/**
145 137
 	 *
146 138
 	 * @param int $itemsPerPage - How many items per page should show up
@@ -176,16 +168,6 @@ public function __construct($itemsPerPage = null) {
176 168
  * 
177 169
  */
178 170
 class GridFieldConfig_RecordEditor extends GridFieldConfig {
179  
-
180  
-	/**
181  
-	 *
182  
-	 * @param int $itemsPerPage - How many items per page should show up
183  
-	 * @return GridFieldConfig_RecordEditor
184  
-	 */
185  
-	public static function create($itemsPerPage=null){
186  
-		return new GridFieldConfig_RecordEditor($itemsPerPage);
187  
-	}
188  
-
189 171
 	/**
190 172
 	 *
191 173
 	 * @param int $itemsPerPage - How many items per page should show up
@@ -225,16 +207,6 @@ public function __construct($itemsPerPage=null) {
225 207
  * </code>
226 208
  */
227 209
 class GridFieldConfig_RelationEditor extends GridFieldConfig {
228  
-
229  
-	/**
230  
-	 *
231  
-	 * @param int $itemsPerPage - How many items per page should show up
232  
-	 * @return GridFieldConfig_RelationEditor
233  
-	 */
234  
-	public static function create($itemsPerPage=null){
235  
-		return new GridFieldConfig_RelationEditor($itemsPerPage);
236  
-	}
237  
-
238 210
 	/**
239 211
 	 *
240 212
 	 * @param int $itemsPerPage - How many items per page should show up

0 notes on commit 70b22fa

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