BUG Ensure GridState_Component is added to GridField config even if we set config with GridField::setConfig

Fixes #6886
This commit is contained in:
Klemen Dolinsek 2017-05-09 07:38:19 +02:00 committed by Christopher Joe
parent 0c6851e597
commit 3dd3036792

View File

@ -104,8 +104,6 @@ class GridField extends FormField {
}
$this->setConfig($config);
$this->config->addComponent(new GridState_Component());
$this->state = new GridState($this);
$this->addExtraClass('ss-gridfield');
@ -177,6 +175,10 @@ class GridField extends FormField {
public function setConfig(GridFieldConfig $config) {
$this->config = $config;
if (!$this->config->getComponentByType('GridState_Component')) {
$this->config->addComponent(new GridState_Component());
}
return $this;
}