diff --git a/src/View/Helper/BootstrapFormHelper.php b/src/View/Helper/BootstrapFormHelper.php index d4e4c5d..a1a0fa5 100644 --- a/src/View/Helper/BootstrapFormHelper.php +++ b/src/View/Helper/BootstrapFormHelper.php @@ -395,7 +395,7 @@ public function file($fieldName, array $options = []) { 'id' => $fieldName, 'secure' => true, 'count-label' => __('files selected'), - 'button-label' => __('Choose File') + 'button-label' => (isset($options['multiple']) && $options['multiple']) ? __('Choose Files') : __('Choose File') ]; $fakeInputCustomOptions = $options['_input']; @@ -412,9 +412,19 @@ public function file($fieldName, array $options = []) { 'escape' => false ])); - $fakeInputCustomOptions += [ - 'value' => $options['val']['name'] - ]; + if (!empty($options['val']) && is_array($options['val'])) { + if (isset($options['val']['name']) || count($options['val']) == 1) { + $fakeInputCustomOptions += [ + 'value' => (isset($options['val']['name'])) ? $options['val']['name'] : $options['val'][0]['name'] + ]; + } + else { + $fakeInputCustomOptions += [ + 'value' => count($options['val']) . ' ' . $countLabel + ]; + } + } + $fakeInput = $this->text($fieldName, array_merge($fakeInputCustomOptions, [ 'name' => $fieldName.'-text', 'readonly' => 'readonly',