From 8bdd7046213903eb89b1ecd8486fd3f7b8e87b32 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 14 Oct 2024 12:15:00 +0400 Subject: [PATCH] corriger la gestion des groupes --- nur_src/v/bs3/fo/ControlSelect.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nur_src/v/bs3/fo/ControlSelect.php b/nur_src/v/bs3/fo/ControlSelect.php index f569df6..237fc75 100644 --- a/nur_src/v/bs3/fo/ControlSelect.php +++ b/nur_src/v/bs3/fo/ControlSelect.php @@ -133,6 +133,7 @@ class ControlSelect extends ControlVisual { "value" => $noItemValue, "text" => $noItemText, "selected" => $value == $noItemValue, + "group" => false, ]; } $haveGroups = $this->ppGroupKey !== null || $this->ppGroupFunc !== null; @@ -167,10 +168,11 @@ class ControlSelect extends ControlVisual { $breaker = new Breaker(); $firstGroup = true; foreach ($options as $option) { - if ($haveGroups && $breaker->shouldBreakOn($option["group"])) { + $group = $option["group"]; + if ($haveGroups && $group !== false && $breaker->shouldBreakOn($group)) { if ($firstGroup) $firstGroup = false; else $control[] = v::end("optgroup"); - $control[] = v::start("optgroup", ["label" => $option["group"]]); + $control[] = v::start("optgroup", ["label" => $group]); } $control[] = $this->ppOptionPrefix; $control[] = v::tag("option", [