JI-857 Add support for optgroup type in semantics
parent
425aac5d33
commit
8067277e63
|
@ -3555,10 +3555,19 @@ class H5PContentValidator {
|
|||
// We have a strict set of options to choose from.
|
||||
$strict = TRUE;
|
||||
$options = array();
|
||||
|
||||
foreach ($semantics->options as $option) {
|
||||
// Support optgroup - just flatten options into one
|
||||
if (isset($option->type) && $option->type === 'optgroup') {
|
||||
foreach ($option->options as $suboption) {
|
||||
$options[$suboption->value] = TRUE;
|
||||
}
|
||||
}
|
||||
elseif (isset($option->value)) {
|
||||
$options[$option->value] = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($semantics->multiple) && $semantics->multiple) {
|
||||
// Multi-choice generates array of values. Test each one against valid
|
||||
|
|
Loading…
Reference in New Issue