From 5790cfea4cc6e627679c9ae58d30aced6dec9a56 Mon Sep 17 00:00:00 2001 From: tacone Date: Tue, 20 Sep 2016 17:01:13 +0200 Subject: [PATCH] remove placeholder from inline multiselects as it gets in the list as a default empty option --- src/DataForm/Field/Multiselect.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/DataForm/Field/Multiselect.php b/src/DataForm/Field/Multiselect.php index a9bf5895..788f3ac6 100644 --- a/src/DataForm/Field/Multiselect.php +++ b/src/DataForm/Field/Multiselect.php @@ -22,8 +22,7 @@ public function getValue() if (is_array($this->value)) { $this->values = $this->value; - } - else { + } else { $this->values = explode($this->serialization_sep, $this->value); } @@ -62,6 +61,8 @@ public function build() case "create": case "modify": $this->attributes['multiple'] = 'multiple'; + $this->attributes['data-placeholder'] = $this->attributes['placeholder']; + $this->attributes['placeholder'] = null; $output .= Form::select($this->name . '[]', $this->options, $this->values, $this->attributes); $output .= $this->extra_output; break; @@ -72,6 +73,7 @@ public function build() default: } + $this->output = $output; } }