Merge branch 'MDL-80818-main' of https://github.com/aanabit/moodle

This commit is contained in:
Andrew Nicols 2024-04-03 13:02:40 +08:00
commit 412fae4792
No known key found for this signature in database
GPG Key ID: 6D1E3157C8CFBF14
2 changed files with 4 additions and 2 deletions

View File

@ -1571,15 +1571,16 @@ class HTML_QuickForm extends HTML_Common {
$elementList = array_flip($elementList);
}
$frozen = [];
foreach (array_keys($this->_elements) as $key) {
$name = $this->_elements[$key]->getName();
if ($this->_freezeAll || isset($elementList[$name])) {
$this->_elements[$key]->freeze();
unset($elementList[$name]);
$frozen[$name] = true;
}
}
if (!empty($elementList)) {
if (count($elementList) != count($frozen)) {
return self::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Nonexistant element(s): '" . implode("', '", array_keys($elementList)) . "' in HTML_QuickForm::freeze()", 'HTML_QuickForm_Error', true);
}
return true;

View File

@ -39,6 +39,7 @@ MDL-78145 - PHP 8.2 compliance. Added a missing class property that still need t
to avoid dynamic properties deprecated error warning.
And also remove the $_elementIdx because it is not needed in Moodle code.
MDL-78527 - Adding a sixth parameter to allow groups to use attributes.
MDL-80818 - Freezing all elements with the same name (e.g. radio buttons)
Pear
====