From 8a6f7c0e384d6e4a27f2d6b0c7e5212af867b4f2 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 19 May 2016 15:02:30 +0200 Subject: [PATCH] ExtensibleSet: remove empty components fixes #11360 --- .../Director/Web/Form/Element/ExtensibleSet.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/library/Director/Web/Form/Element/ExtensibleSet.php b/library/Director/Web/Form/Element/ExtensibleSet.php index 3b4ec311..d17d978b 100644 --- a/library/Director/Web/Form/Element/ExtensibleSet.php +++ b/library/Director/Web/Form/Element/ExtensibleSet.php @@ -15,6 +15,21 @@ class ExtensibleSet extends FormElement // private $multiOptions; + public function getValue() + { + $value = parent::getValue(); + if (! is_array($value)) { + $value = array($value); + } + $value = array_filter($value, 'strlen'); + + if (empty($value)) { + return null; + } + + return $value; + } + public function isValid($value, $context = null) { if ($value === null) {