mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 12:45:04 +01:00
MDL-38719 forms: detectMissingSetType() handle of repetitions.
It seems that formslib, for repetition, relies in the type especified by the main (non existent at the end) element, instead of assingning a type to each repetition. Surely a result of storing types apart from elements. :-( With the patch, detectMissingSetType() will detect repeated elements (name containing '[') and will perform the verification against that main element type.
This commit is contained in:
parent
f35f07e9f7
commit
caa30cd625
@ -1261,6 +1261,15 @@ abstract class moodleform {
|
||||
case 'text':
|
||||
case 'url':
|
||||
$key = $element->getName();
|
||||
// For repeated elements we need to look for
|
||||
// the "main" type, not for the one present
|
||||
// on each repetition. All the stuff in formslib
|
||||
// (repeat_elements(), updateSubmission()... seems
|
||||
// to work that way.
|
||||
$pos = strpos($key, '[');
|
||||
if ($pos !== false) {
|
||||
$key = substr($key, 0, $pos);
|
||||
}
|
||||
if (!array_key_exists($key, $mform->_types)) {
|
||||
debugging("Did you remember to call setType() for '$key'? ".
|
||||
'Defaulting to PARAM_RAW cleaning.', DEBUG_DEVELOPER);
|
||||
|
Loading…
x
Reference in New Issue
Block a user