Merge pull request #614 from ajshort/gridfieldsetconfig

NEW Add set config method to GridField.
This commit is contained in:
Will Rossiter 2012-07-03 23:11:01 -07:00
commit db4cb8de7e

15
forms/gridfield/GridField.php Executable file → Normal file
View File

@ -80,11 +80,7 @@ class GridField extends FormField {
$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);
@ -134,6 +130,15 @@ class GridField extends FormField {
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();
}