Permalink
Browse files

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...
1 parent c738744 commit 70b22fa4cacc5e4978f9599a7d80b61d4e9589cd @Zauberfisch Zauberfisch committed with sminnee Aug 19, 2012
Showing with 10 additions and 38 deletions.
  1. +10 −38 forms/gridfield/GridFieldConfig.php
@@ -14,20 +14,22 @@
* - {@link GridFieldConfig_RelationEditor}
*/
class GridFieldConfig {
-
/**
*
- * @return GridFieldConfig
+ * @var ArrayList
*/
- public static function create(){
- return new GridFieldConfig();
- }
+ protected $components = null;
/**
- *
- * @var ArrayList
+ * @param mixed $arguments,... arguments to pass to the constructor
+ * @return GridFieldConfig
*/
- protected $components = null;
+ public static function create() {
+ return call_user_func_array('Object::create', array_merge(
+ array(get_called_class()),
+ func_get_args()
+ ));
+ }
/**
*
@@ -131,16 +133,6 @@ public function getComponentByType($type) {
* with sortable and searchable headers.
*/
class GridFieldConfig_Base extends GridFieldConfig {
-
- /**
- *
- * @param int $itemsPerPage - How many items per page should show up per page
- * @return GridFieldConfig_Base
- */
- public static function create($itemsPerPage=null){
- return new GridFieldConfig_Base($itemsPerPage);
- }
-
/**
*
* @param int $itemsPerPage - How many items per page should show up
@@ -176,16 +168,6 @@ public function __construct($itemsPerPage = null) {
*
*/
class GridFieldConfig_RecordEditor extends GridFieldConfig {
-
- /**
- *
- * @param int $itemsPerPage - How many items per page should show up
- * @return GridFieldConfig_RecordEditor
- */
- public static function create($itemsPerPage=null){
- return new GridFieldConfig_RecordEditor($itemsPerPage);
- }
-
/**
*
* @param int $itemsPerPage - How many items per page should show up
@@ -225,16 +207,6 @@ public function __construct($itemsPerPage=null) {
* </code>
*/
class GridFieldConfig_RelationEditor extends GridFieldConfig {
-
- /**
- *
- * @param int $itemsPerPage - How many items per page should show up
- * @return GridFieldConfig_RelationEditor
- */
- public static function create($itemsPerPage=null){
- return new GridFieldConfig_RelationEditor($itemsPerPage);
- }
-
/**
*
* @param int $itemsPerPage - How many items per page should show up

0 comments on commit 70b22fa

Please sign in to comment.