parent
540c96178d
commit
31ee0bd51a
|
@ -2652,17 +2652,10 @@ class H5PContentValidator {
|
||||||
// Validate each element in list.
|
// Validate each element in list.
|
||||||
foreach ($list as $key => &$value) {
|
foreach ($list as $key => &$value) {
|
||||||
if (!is_int($key)) {
|
if (!is_int($key)) {
|
||||||
array_splice($list, $key, 1);
|
unset($list[$key]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$this->$function($value, $field);
|
$this->$function($value, $field);
|
||||||
if ($value === NULL) {
|
|
||||||
array_splice($list, $key, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($list) === 0) {
|
|
||||||
$list = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2772,9 +2765,6 @@ class H5PContentValidator {
|
||||||
if ($found) {
|
if ($found) {
|
||||||
if ($function) {
|
if ($function) {
|
||||||
$this->$function($value, $field);
|
$this->$function($value, $field);
|
||||||
if ($value === NULL) {
|
|
||||||
unset($group->$key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// We have a field type in semantics for which we don't have a
|
// We have a field type in semantics for which we don't have a
|
||||||
|
@ -2810,13 +2800,9 @@ class H5PContentValidator {
|
||||||
* Will recurse into validating the library's semantics too.
|
* Will recurse into validating the library's semantics too.
|
||||||
*/
|
*/
|
||||||
public function validateLibrary(&$value, $semantics) {
|
public function validateLibrary(&$value, $semantics) {
|
||||||
if (!isset($value->library)) {
|
if (!isset($value->library) || !in_array($value->library, $semantics->options)) {
|
||||||
$value = NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!in_array($value->library, $semantics->options)) {
|
|
||||||
$this->h5pF->setErrorMessage($this->h5pF->t('Library used in content is not a valid library according to semantics'));
|
$this->h5pF->setErrorMessage($this->h5pF->t('Library used in content is not a valid library according to semantics'));
|
||||||
$value = NULL;
|
$value = new stdClass();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue