From b8975721d3f25b0e55daf9a23601fd6ceaf0ea63 Mon Sep 17 00:00:00 2001 From: Christopher Pitt Date: Tue, 17 Nov 2015 12:53:04 +1300 Subject: [PATCH] Preventing multiple states added to single config --- forms/gridfield/GridField.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/forms/gridfield/GridField.php b/forms/gridfield/GridField.php index ca9fa7f61..6ea7854b8 100644 --- a/forms/gridfield/GridField.php +++ b/forms/gridfield/GridField.php @@ -105,7 +105,12 @@ class GridField extends FormField { $this->setConfig($config); - $this->config->addComponent(new GridState_Component()); + $state = $this->config->getComponentByType('GridState_Component'); + + if (!$state) { + $this->config->addComponent(new GridState_Component()); + } + $this->state = new GridState($this); $this->addExtraClass('ss-gridfield');