From af642354fb21141d79cbc130b7f0138e53fde0c1 Mon Sep 17 00:00:00 2001 From: Michael Grosse <grosse@cosmocode.de> Date: Wed, 11 May 2016 16:08:23 +0200 Subject: [PATCH] Fix resetting select-options attributes --- inc/Form/DropdownElement.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/Form/DropdownElement.php b/inc/Form/DropdownElement.php index 5b77566ab..6a2147d0a 100644 --- a/inc/Form/DropdownElement.php +++ b/inc/Form/DropdownElement.php @@ -113,8 +113,9 @@ class DropdownElement extends InputElement { $html = '<select ' . buildAttributes($this->attrs()) . '>'; foreach($this->options as $key => $val) { $selected = ($key == $this->value) ? ' selected="selected"' : ''; + $attrs = ''; if (is_array($val['attrs'])) { - array_walk($val['attrs'],function (&$aval, $akey){$aval = hsc($akey)."='".hsc($aval)."'";}); + array_walk($val['attrs'],function (&$aval, $akey){$aval = hsc($akey).'="'.hsc($aval).'"';}); $attrs = join(' ', $val['attrs']); } $html .= '<option' . $selected . ' value="' . hsc($key) . '" '.$attrs.'>' . hsc($val['label']) . '</option>'; -- GitLab