From 8067277e63804b8241acf46774b006627271bdca Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Mon, 17 Sep 2018 08:41:31 +0200 Subject: [PATCH] JI-857 Add support for optgroup type in semantics --- h5p.classes.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/h5p.classes.php b/h5p.classes.php index a93d8a4..a3c5dca 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -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; + } } }