Skip to content
This repository
Browse code

NEW Add set config method to GridField.

  • Loading branch information...
commit eb733dee60a7267dd9ed918d290b30581b41df78 1 parent 9c57294
Andrew Short authored July 04, 2012

Showing 1 changed file with 13 additions and 8 deletions. Show diff stats Hide diff stats

  1. 21  forms/gridfield/GridField.php
21  forms/gridfield/GridField.php 100755 → 100644
@@ -79,13 +79,9 @@ public function __construct($name, $title = null, SS_List $dataList = null, Grid
79 79
 		if($dataList) {
80 80
 			$this->setList($dataList);
81 81
 		}
82  
-		
83  
-		if(!$config) {
84  
-			$this->config = GridFieldConfig_Base::create();
85  
-		} else {
86  
-			$this->config = $config;
87  
-		}
88  
-		
  82
+
  83
+		$this->setConfig($config ?: GridFieldConfig_Base::create());
  84
+
89 85
 		$this->config->addComponent(new GridState_Component());
90 86
 		$this->state = new GridState($this);		
91 87
 		
@@ -133,7 +129,16 @@ public function getModelClass() {
133 129
 	public function getConfig() {
134 130
 		return $this->config;
135 131
 	}
136  
-	
  132
+
  133
+	/**
  134
+	 * @param GridFieldConfig $config
  135
+	 * @return GridField
  136
+	 */
  137
+	public function setConfig(GridFieldConfig $config) {
  138
+		$this->config = $config;
  139
+		return $this;
  140
+	}
  141
+
137 142
 	public function getComponents() {
138 143
 		return $this->config->getComponents();
139 144
 	}

0 notes on commit eb733de

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