Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

NEW Add set config method to GridField.

  • Loading branch information...
commit eb733dee60a7267dd9ed918d290b30581b41df78 1 parent 9c57294
Andrew Short ajshort authored
Showing with 13 additions and 8 deletions.
  1. +13 −8 forms/gridfield/GridField.php
21 forms/gridfield/GridField.php 100755 → 100644
View
@@ -79,13 +79,9 @@ public function __construct($name, $title = null, SS_List $dataList = null, Grid
if($dataList) {
$this->setList($dataList);
}
-
- if(!$config) {
- $this->config = GridFieldConfig_Base::create();
- } else {
- $this->config = $config;
- }
-
+
+ $this->setConfig($config ?: GridFieldConfig_Base::create());
+
$this->config->addComponent(new GridState_Component());
$this->state = new GridState($this);
@@ -133,7 +129,16 @@ public function getModelClass() {
public function getConfig() {
return $this->config;
}
-
+
+ /**
+ * @param GridFieldConfig $config
+ * @return GridField
+ */
+ public function setConfig(GridFieldConfig $config) {
+ $this->config = $config;
+ return $this;
+ }
+
public function getComponents() {
return $this->config->getComponents();
}
Please sign in to comment.
Something went wrong with that request. Please try again.