Merge branch 'release' of https://github.com/h5p/h5p-php-library into moodle-rc3
commit
7d86a6235b
|
@ -1665,7 +1665,7 @@ class H5PCore {
|
||||||
|
|
||||||
public static $coreApi = array(
|
public static $coreApi = array(
|
||||||
'majorVersion' => 1,
|
'majorVersion' => 1,
|
||||||
'minorVersion' => 8
|
'minorVersion' => 9
|
||||||
);
|
);
|
||||||
public static $styles = array(
|
public static $styles = array(
|
||||||
'styles/h5p.css',
|
'styles/h5p.css',
|
||||||
|
@ -2852,6 +2852,7 @@ class H5PContentValidator {
|
||||||
* @param $semantics
|
* @param $semantics
|
||||||
*/
|
*/
|
||||||
public function validateSelect(&$select, $semantics) {
|
public function validateSelect(&$select, $semantics) {
|
||||||
|
$optional = isset($semantics->optional) && $semantics->optional;
|
||||||
$strict = FALSE;
|
$strict = FALSE;
|
||||||
if (isset($semantics->options) && !empty($semantics->options)) {
|
if (isset($semantics->options) && !empty($semantics->options)) {
|
||||||
// We have a strict set of options to choose from.
|
// We have a strict set of options to choose from.
|
||||||
|
@ -2871,7 +2872,7 @@ class H5PContentValidator {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($select as $key => &$value) {
|
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.'));
|
$this->h5pF->setErrorMessage($this->h5pF->t('Invalid selected option in multi-select.'));
|
||||||
unset($select[$key]);
|
unset($select[$key]);
|
||||||
}
|
}
|
||||||
|
@ -2887,7 +2888,7 @@ class H5PContentValidator {
|
||||||
$select = $select[0];
|
$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.'));
|
$this->h5pF->setErrorMessage($this->h5pF->t('Invalid selected option in select.'));
|
||||||
$select = $semantics->options[0]->value;
|
$select = $semantics->options[0]->value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue