Make sure fields in optional groups also becomes optional.

d6
Frode Petterson 2015-01-20 14:48:22 +01:00
parent 8cee9820b0
commit ead790ae1a
1 changed files with 13 additions and 8 deletions

View File

@ -2574,6 +2574,9 @@ class H5PContentValidator {
$found = FALSE;
foreach ($semantics->fields as $field) {
if ($field->name == $key) {
if (isset($semantics->optional) && $semantics->optional) {
$field->optional = TRUE;
}
$function = $this->typeMap[$field->type];
$found = TRUE;
break;
@ -2598,6 +2601,7 @@ class H5PContentValidator {
}
}
}
if (!(isset($semantics->optional) && $semantics->optional)) {
foreach ($semantics->fields as $field) {
if (!(isset($field->optional) && $field->optional)) {
// Check if field is in group.
@ -2607,6 +2611,7 @@ class H5PContentValidator {
}
}
}
}
/**
* Validate given library value against library semantics.