Allow sub-select to be iterable to accept array and collection (#540)
This commit is contained in:
1 parent
fda9d3dad8
commit
974605fcd2
2 files changed
+54
-2
No files matched your search
+2
-2
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user