Make sure fields in optional groups also becomes optional.
parent
8cee9820b0
commit
ead790ae1a
|
@ -2574,6 +2574,9 @@ class H5PContentValidator {
|
||||||
$found = FALSE;
|
$found = FALSE;
|
||||||
foreach ($semantics->fields as $field) {
|
foreach ($semantics->fields as $field) {
|
||||||
if ($field->name == $key) {
|
if ($field->name == $key) {
|
||||||
|
if (isset($semantics->optional) && $semantics->optional) {
|
||||||
|
$field->optional = TRUE;
|
||||||
|
}
|
||||||
$function = $this->typeMap[$field->type];
|
$function = $this->typeMap[$field->type];
|
||||||
$found = TRUE;
|
$found = TRUE;
|
||||||
break;
|
break;
|
||||||
|
@ -2598,6 +2601,7 @@ class H5PContentValidator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!(isset($semantics->optional) && $semantics->optional)) {
|
||||||
foreach ($semantics->fields as $field) {
|
foreach ($semantics->fields as $field) {
|
||||||
if (!(isset($field->optional) && $field->optional)) {
|
if (!(isset($field->optional) && $field->optional)) {
|
||||||
// Check if field is in group.
|
// Check if field is in group.
|
||||||
|
@ -2607,6 +2611,7 @@ class H5PContentValidator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate given library value against library semantics.
|
* Validate given library value against library semantics.
|
||||||
|
|
Loading…
Reference in New Issue