mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-12133 - Errors calling parent::validation in a moodle form subclass because the base class method returns true not an empty array. This patch allow subclasses to start their validate method with
$errors = parent::validation($data, $files); which is what you naturally want to do if you are used to object oriented programming. Merged from MOODLE_19_STABLE.
This commit is contained in:
parent
ea16c547ee
commit
13ccb7bd58
1 changed files with 3 additions and 2 deletions
|
@ -511,10 +511,11 @@ class moodleform {
|
||||||
*
|
*
|
||||||
* @param array $data array of ("fieldname"=>value) of submitted data
|
* @param array $data array of ("fieldname"=>value) of submitted data
|
||||||
* @param array $files array of uploaded files "element_name"=>tmp_file_path
|
* @param array $files array of uploaded files "element_name"=>tmp_file_path
|
||||||
* @return bool array of errors or true if ok "element_name"=>"error_description"
|
* @return mixed an array of "element_name"=>"error_description" if there are errors.
|
||||||
|
* true or an empty array if everything is OK.
|
||||||
*/
|
*/
|
||||||
function validation($data, $files) {
|
function validation($data, $files) {
|
||||||
return true;
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue