diff --git a/.travis.yml b/.travis.yml index 34534a945..b2721b38b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: php +dist: precise + sudo: false addons: diff --git a/forms/gridfield/GridField.php b/forms/gridfield/GridField.php index 27ed34010..d0190411e 100644 --- a/forms/gridfield/GridField.php +++ b/forms/gridfield/GridField.php @@ -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; }