mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #614 from ajshort/gridfieldsetconfig
NEW Add set config method to GridField.
This commit is contained in:
commit
db4cb8de7e
21
forms/gridfield/GridField.php
Executable file → Normal file
21
forms/gridfield/GridField.php
Executable file → Normal file
@ -79,13 +79,9 @@ class GridField extends FormField {
|
|||||||
if($dataList) {
|
if($dataList) {
|
||||||
$this->setList($dataList);
|
$this->setList($dataList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$config) {
|
$this->setConfig($config ?: GridFieldConfig_Base::create());
|
||||||
$this->config = GridFieldConfig_Base::create();
|
|
||||||
} else {
|
|
||||||
$this->config = $config;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->config->addComponent(new GridState_Component());
|
$this->config->addComponent(new GridState_Component());
|
||||||
$this->state = new GridState($this);
|
$this->state = new GridState($this);
|
||||||
|
|
||||||
@ -133,7 +129,16 @@ class GridField extends FormField {
|
|||||||
public function getConfig() {
|
public function getConfig() {
|
||||||
return $this->config;
|
return $this->config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param GridFieldConfig $config
|
||||||
|
* @return GridField
|
||||||
|
*/
|
||||||
|
public function setConfig(GridFieldConfig $config) {
|
||||||
|
$this->config = $config;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function getComponents() {
|
public function getComponents() {
|
||||||
return $this->config->getComponents();
|
return $this->config->getComponents();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user