corriger la gestion des groupes
This commit is contained in:
parent
4bc7a65c52
commit
8bdd704621
|
@ -133,6 +133,7 @@ class ControlSelect extends ControlVisual {
|
||||||
"value" => $noItemValue,
|
"value" => $noItemValue,
|
||||||
"text" => $noItemText,
|
"text" => $noItemText,
|
||||||
"selected" => $value == $noItemValue,
|
"selected" => $value == $noItemValue,
|
||||||
|
"group" => false,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$haveGroups = $this->ppGroupKey !== null || $this->ppGroupFunc !== null;
|
$haveGroups = $this->ppGroupKey !== null || $this->ppGroupFunc !== null;
|
||||||
|
@ -167,10 +168,11 @@ class ControlSelect extends ControlVisual {
|
||||||
$breaker = new Breaker();
|
$breaker = new Breaker();
|
||||||
$firstGroup = true;
|
$firstGroup = true;
|
||||||
foreach ($options as $option) {
|
foreach ($options as $option) {
|
||||||
if ($haveGroups && $breaker->shouldBreakOn($option["group"])) {
|
$group = $option["group"];
|
||||||
|
if ($haveGroups && $group !== false && $breaker->shouldBreakOn($group)) {
|
||||||
if ($firstGroup) $firstGroup = false;
|
if ($firstGroup) $firstGroup = false;
|
||||||
else $control[] = v::end("optgroup");
|
else $control[] = v::end("optgroup");
|
||||||
$control[] = v::start("optgroup", ["label" => $option["group"]]);
|
$control[] = v::start("optgroup", ["label" => $group]);
|
||||||
}
|
}
|
||||||
$control[] = $this->ppOptionPrefix;
|
$control[] = $this->ppOptionPrefix;
|
||||||
$control[] = v::tag("option", [
|
$control[] = v::tag("option", [
|
||||||
|
|
Loading…
Reference in New Issue