Skip to content

Commit

Permalink
NEW Add set config method to GridField.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajshort committed Jul 4, 2012
1 parent 9c57294 commit eb733de
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions forms/gridfield/GridField.php 100755 → 100644
Expand Up @@ -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);

Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit eb733de

Please sign in to comment.