Merge branch 'master' of github.com:LaravelCollective/html

This commit is contained in:
Tom Shafer committed 2018-02-05 08:09:36 -07:00
commit 32c27a54cd
4 files changed
+28 -12

No files matched your search

+10 -7
View File
@@ -709,20 +709,23 @@ class FormBuilder
* @param string $selected
* @param array $attributes
* @param array $optionsAttributes
* @param integer $level
*
* @return \Illuminate\Support\HtmlString
*/
protected function optionGroup($list, $label, $selected, array $attributes = [], array $optionsAttributes = [])
protected function optionGroup($list, $label, $selected, array $attributes = [], array $optionsAttributes = [], $level = 0)
{
$html = [];
$space = str_repeat(" ", $level);
foreach ($list as $value => $display) {
$optionAttributes = $optionsAttributes[$value] ?? [];
$html[] = $this->option($display, $value, $selected, $optionAttributes);
if (is_array($display)) {
$html[] = $this->optionGroup($display, $value, $selected, $attributes, $optionAttributes, $level+5);
} else {
$html[] = $this->option($space.$display, $value, $selected, $attributes, $optionAttributes);
}
}
return $this->toHtmlString('<optgroup label="' . e($label) . '"' . $this->html->attributes($attributes) . '>' . implode('', $html) . '</optgroup>');
return $this->toHtmlString('<optgroup label="' . e($space.$label) . '">' . implode('', $html) . '</optgroup>');
}
/**
@@ -766,7 +769,7 @@ class FormBuilder
'value' => '',
];
return $this->toHtmlString('<option' . $this->html->attributes($options) . '>' . e($display) . '</option>');
return $this->toHtmlString('<option' . $this->html->attributes($options) . ' hidden="hidden">' . e($display) . '</option>');
}
/**