Merge pull request #25 from h5p/release
Merge 'release' into 'improved-file-handling'JI-92-path-fix
commit
218e48ee91
|
@ -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