MDL-78527 pear: Adding attributes parameter to groups
This commit is contained in:
@@ -383,10 +383,12 @@ class HTML_QuickForm_element extends HTML_Common
|
||||
{
|
||||
switch ($event) {
|
||||
case 'createElement':
|
||||
static::__construct($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
|
||||
static::__construct($arg[0], $arg[1], $arg[2], $arg[3], $arg[4], $arg[5]);
|
||||
if ($caller->getAttribute('data-random-ids') && !$this->getAttribute('id')) {
|
||||
$this->_generateId();
|
||||
$this->updateAttributes(array('id' => $this->getAttribute('id') . '_' . random_string()));
|
||||
$attributes = $this->getAttributes();
|
||||
$attributes['id'] = $this->getAttribute('id') . '_' . random_string();
|
||||
$this->updateAttributes($attributes);
|
||||
}
|
||||
break;
|
||||
case 'addElement':
|
||||
|
||||
@@ -88,12 +88,13 @@ class HTML_QuickForm_group extends HTML_QuickForm_element
|
||||
* @param bool $appendName (optional)whether to change elements' names to
|
||||
* the form $groupName[$elementName] or leave
|
||||
* them as is.
|
||||
* @param mixed $attributes Either a typical HTML attribute string or an associative array
|
||||
* @since 1.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) {
|
||||
parent::__construct($elementName, $elementLabel);
|
||||
public function __construct($elementName = null, $elementLabel = null, $elements = null, $separator = null, $appendName = true, $attributes = null) {
|
||||
parent::__construct($elementName, $elementLabel, $attributes);
|
||||
$this->_type = 'group';
|
||||
if (isset($elements) && is_array($elements)) {
|
||||
$this->setElements($elements);
|
||||
@@ -104,6 +105,9 @@ class HTML_QuickForm_group extends HTML_QuickForm_element
|
||||
if (isset($appendName)) {
|
||||
$this->_appendName = $appendName;
|
||||
}
|
||||
if (isset($attributes)) {
|
||||
$this->_attributes = $attributes;
|
||||
}
|
||||
} //end constructor
|
||||
|
||||
/**
|
||||
@@ -111,7 +115,7 @@ class HTML_QuickForm_group extends HTML_QuickForm_element
|
||||
*
|
||||
* @deprecated since Moodle 3.1
|
||||
*/
|
||||
public function HTML_QuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) {
|
||||
public function HTML_QuickForm_group($elementName = null, $elementLabel = null, $elements = null, $separator = null, $appendName = true, $attributes = null) {
|
||||
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
|
||||
self::__construct($elementName, $elementLabel, $elements, $separator, $appendName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user