mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
MDL-62550 core_form: bring back the form item unique ids to fix js fails
This id matches the id seen on the clean theme elements and is needed by the forms js.
This commit is contained in:
parent
38a1b4f203
commit
574861588a
3 changed files with 26 additions and 1 deletions
|
@ -4509,6 +4509,22 @@ EOD;
|
|||
}
|
||||
}
|
||||
|
||||
// Generate the form element wrapper ids and names to pass to the template.
|
||||
// This differs between group and non-group elements.
|
||||
if ($element->getType() === 'group') {
|
||||
// Group element.
|
||||
// The id will be something like 'fgroup_id_NAME'. E.g. fgroup_id_mygroup.
|
||||
$elementcontext['wrapperid'] = $elementcontext['id'];
|
||||
|
||||
// Ensure group elements pass through the group name as the element name so the id_error_{{element.name}} is
|
||||
// properly set in the template.
|
||||
$elementcontext['name'] = $elementcontext['groupname'];
|
||||
} else {
|
||||
// Non grouped element.
|
||||
// Creates an id like 'fitem_id_NAME'. E.g. fitem_id_mytextelement.
|
||||
$elementcontext['wrapperid'] = 'fitem_' . $elementcontext['id'];
|
||||
}
|
||||
|
||||
$context = array(
|
||||
'element' => $elementcontext,
|
||||
'label' => $label,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue