Skip to content

Commit 705dcaf

Browse files
committed
[5.4] Fix OptionsRule validation to support groupedlist fields
1 parent 2ccd259 commit 705dcaf

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

libraries/src/Form/Rule/OptionsRule.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,16 @@ public function test(\SimpleXMLElement $element, $value, $group = null, ?Registr
6969
$options[] = $opt->value;
7070
}
7171
} else {
72+
// Handle direct <option> children
7273
foreach ($element->option as $opt) {
73-
$options[] = $opt->attributes()->value;
74+
$options[] = (string) $opt->attributes()->value;
75+
}
76+
77+
// Handle <group> children for groupedlist fields
78+
foreach ($element->group as $groupNode) {
79+
foreach ($groupNode->option as $opt) {
80+
$options[] = (string) $opt->attributes()->value;
81+
}
7482
}
7583
}
7684

0 commit comments

Comments
 (0)