MDL-78527 pear: Adding attributes parameter to groups

This commit is contained in:
Amaia Anabitarte
2023-09-12 09:59:36 +02:00
parent 0122c2c3e7
commit 313da3ebf3
4 changed files with 16 additions and 8 deletions
+4 -3
View File
@@ -576,7 +576,7 @@ class HTML_QuickForm extends HTML_Common {
$includeFile = $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][$type][0];
include_once($includeFile);
$elementObject = new $className(); //Moodle: PHP 5.3 compatibility
for ($i = 0; $i < 5; $i++) {
for ($i = 0; $i < 6; $i++) {
if (!isset($args[$i])) {
$args[$i] = null;
}
@@ -724,12 +724,13 @@ class HTML_QuickForm extends HTML_Common {
* @param string $separator (optional)string to separate elements
* @param bool $appendName (optional)specify whether the group name should be
* used in the form element name ex: group[element]
* @param mixed $attributes Either a typical HTML attribute string or an associative array
* @return object reference to added group of elements
* @since 2.8
* @access public
* @throws PEAR_Error
*/
function &addGroup($elements, $name=null, $groupLabel='', $separator=null, $appendName = true)
function &addGroup($elements, $name = null, $groupLabel = '', $separator = null, $appendName = true, $attributes = null)
{
static $anonGroups = 1;
@@ -737,7 +738,7 @@ class HTML_QuickForm extends HTML_Common {
$name = 'qf_group_' . $anonGroups++;
$appendName = false;
}
$group =& $this->addElement('group', $name, $groupLabel, $elements, $separator, $appendName);
$group =& $this->addElement('group', $name, $groupLabel, $elements, $separator, $appendName, $attributes);
return $group;
} // end func addGroup