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:
Jake Dallimore 2018-08-09 10:54:08 +08:00
parent 38a1b4f203
commit 574861588a
3 changed files with 26 additions and 1 deletions

View file

@ -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,