OPPG-459: "multiple" option for semantic type "select"
Specifies that the select shall handle multiple options. Used by dynamicCheckboxes widget.namespaces
parent
fcc9ed4e24
commit
6d231499e3
|
@ -1332,9 +1332,14 @@ class H5PContentValidator {
|
|||
}
|
||||
}
|
||||
|
||||
// Multichoice generates array of values. Test each one against valid
|
||||
// options, if we are strict.
|
||||
if (is_array($select)) {
|
||||
if (isset($semantics->multiple) && $semantics->multiple) {
|
||||
// Multichoice generates array of values. Test each one against valid
|
||||
// options, if we are strict. First make sure we are working on an
|
||||
// array.
|
||||
if (!is_array($select)) {
|
||||
$select = array($select);
|
||||
}
|
||||
|
||||
foreach ($select as $key => $value) {
|
||||
if ($strict && !isset($options[$value])) {
|
||||
$this->h5pF->setErrorMessage($this->h5pF->t('Invalid selected option in multiselect.'));
|
||||
|
@ -1346,6 +1351,12 @@ class H5PContentValidator {
|
|||
}
|
||||
}
|
||||
else {
|
||||
// Single mode. If we get an array in here, we chop off the first
|
||||
// element and use that instead.
|
||||
if (is_array($select)) {
|
||||
$select = $select[0];
|
||||
}
|
||||
|
||||
if ($strict && !isset($options[$select])) {
|
||||
$this->h5pF->setErrorMessage($this->h5pF->t('Invalid selected option in select.'));
|
||||
$select = $semantics->options[0]->value;
|
||||
|
|
Loading…
Reference in New Issue