Allow sub-select to be iterable to accept array and collection (#540)

This commit is contained in:
Tautvydas authored and Tom Shafer committed 2018-06-18 08:04:16 -07:00
1 parent fda9d3dad8
commit 974605fcd2
2 files changed
+54 -2

No files matched your search

+2 -2
View File
@@ -737,7 +737,7 @@ class FormBuilder
*/
public function getSelectOption($display, $value, $selected, array $attributes = [], array $optgroupAttributes = [])
{
if (is_array($display)) {
if (is_iterable($display)) {
return $this->optionGroup($display, $value, $selected, $optgroupAttributes, $attributes);
}
@@ -762,7 +762,7 @@ class FormBuilder
$space = str_repeat(" ", $level);
foreach ($list as $value => $display) {
$optionAttributes = $optionsAttributes[$value] ?? [];
if (is_array($display)) {
if (is_iterable($display)) {
$html[] = $this->optionGroup($display, $value, $selected, $attributes, $optionAttributes, $level+5);
} else {
$html[] = $this->option($space.$display, $value, $selected, $optionAttributes);