JI-857 Add support for optgroup type in semantics

HFP-2095-Fix-table-styling
Paal Joergensen 2018-09-17 08:41:31 +02:00
parent 425aac5d33
commit 8067277e63
1 changed files with 10 additions and 1 deletions

View File

@ -3555,8 +3555,17 @@ class H5PContentValidator {
// We have a strict set of options to choose from.
$strict = TRUE;
$options = array();
foreach ($semantics->options as $option) {
$options[$option->value] = TRUE;
// 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;
}
}
}