diff --git a/source/php/Component/Select/Select.php b/source/php/Component/Select/Select.php index e70222f8..ddcc8f9a 100644 --- a/source/php/Component/Select/Select.php +++ b/source/php/Component/Select/Select.php @@ -34,7 +34,7 @@ public function init() //Set general classes $this->data['classList'][] = $this->getBaseClass($size, true); - if ($multiple) { + if (!empty($multiple)) { $this->data['isMultiSelect'] = true; $this->data['classList'][] = $this->getBaseClass('multiselect', true); @@ -48,7 +48,7 @@ public function init() ]; } - if(!$multiple) { + if(empty($multiple)) { $this->data['isMultiSelect'] = false; $this->data['classList'][] = $this->getBaseClass('singleselect', true); @@ -69,16 +69,16 @@ public function init() $this->data['intersection'] = array_intersect_key($options, $preselectedKeys); } - if ($name) { - $this->data['selectAttributeList']['name'] = $name; + if (!empty($name)) { + $this->data['selectAttributeList']['name'] = $name . (!empty($multiple) ? '[]' : ''); } - if ($errorMessage) { + if (!empty($errorMessage)) { $this->data['data-invalid-message'] = $errorMessage; $this->data['classList'][] = "has-invalid-message"; } - if ($required) { + if (!empty($required)) { $this->data['selectAttributeList']['required'] = 'required'; $this->data['selectAttributeList']['aria-hidden'] = 'true'; $this->data['selectAttributeList']['data-required'] = '1'; @@ -93,7 +93,7 @@ public function init() $this->data['selectAttributeList'] ); - $this->data['clearButtonEnabled'] = !$multiple && !$required; + $this->data['clearButtonEnabled'] = empty($multiple) && empty($required); //Determine if this is selected $this->data['isSelected'] = function($key, $boolean = true) diff --git a/source/php/Component/Select/select.blade.php b/source/php/Component/Select/select.blade.php index cc446588..6b7cf64d 100644 --- a/source/php/Component/Select/select.blade.php +++ b/source/php/Component/Select/select.blade.php @@ -1,14 +1,14 @@
- @if ($label && $hideLabel) + @if (!empty($label) && !empty($hideLabel)) @endif - @if ($label && !$hideLabel) + @if (!empty($label) && empty($hideLabel))