diff --git a/h5p.classes.php b/h5p.classes.php index 64c2ab5..0b2d7f8 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1665,7 +1665,7 @@ class H5PCore { public static $coreApi = array( 'majorVersion' => 1, - 'minorVersion' => 8 + 'minorVersion' => 9 ); public static $styles = array( 'styles/h5p.css', @@ -2852,6 +2852,7 @@ class H5PContentValidator { * @param $semantics */ public function validateSelect(&$select, $semantics) { + $optional = isset($semantics->optional) && $semantics->optional; $strict = FALSE; if (isset($semantics->options) && !empty($semantics->options)) { // We have a strict set of options to choose from. @@ -2871,7 +2872,7 @@ class H5PContentValidator { } foreach ($select as $key => &$value) { - if ($strict && !isset($options[$value])) { + if ($strict && !$optional && !isset($options[$value])) { $this->h5pF->setErrorMessage($this->h5pF->t('Invalid selected option in multi-select.')); unset($select[$key]); } @@ -2887,7 +2888,7 @@ class H5PContentValidator { $select = $select[0]; } - if ($strict && !isset($options[$select])) { + if ($strict && !$optional && !isset($options[$select])) { $this->h5pF->setErrorMessage($this->h5pF->t('Invalid selected option in select.')); $select = $semantics->options[0]->value; }