From a247ca470ccbc7515c1a3d5166b5561ec364ec70 Mon Sep 17 00:00:00 2001 From: Frank Ronny Larsen Date: Tue, 9 Jul 2013 10:10:32 +0200 Subject: [PATCH] OPPG-413: Validator just got a little more annoying. Gives warning if mandatory fields are missing in group --- h5p.classes.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/h5p.classes.php b/h5p.classes.php index e4b3d20..0e2edc1 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1375,6 +1375,14 @@ class H5PContentValidator { } } } + foreach ($semantics->fields as $field) { + if (!(isset($field->optional) && $field->optional)) { + // Check if field is in group. + if (! property_exists($group, $field->name)) { + $this->h5pF->setErrorMessage($this->h5pF->t('No value given for mandatory field ' . $field->name)); + } + } + } } /**