MDL-36939 cache: instance form validation now handles errors properly
authorSam Hemelryk <sam@moodle.com>
Fri, 30 Nov 2012 01:45:05 +0000 (14:45 +1300)
committerSam Hemelryk <sam@moodle.com>
Thu, 6 Dec 2012 19:38:05 +0000 (08:38 +1300)
cache/forms.php

index 533f1f8..542e7a0 100644 (file)
@@ -101,7 +101,13 @@ class cachestore_addinstance_form extends moodleform {
         }
 
         if (method_exists($this, 'configuration_validation')) {
-            $errors = $this->configuration_validation($data, $files);
+            $newerrors = $this->configuration_validation($data, $files, $errors);
+            // We need to selectiviliy merge here
+            foreach ($newerrors as $element => $error) {
+                if (!array_key_exists($element, $errors)) {
+                    $errors[$element] = $error;
+                }
+            }
         }
 
         return $errors;