MDL-71336 forms: ensure grouped date elements have unique IDs.

Previously they were each taking the ID of their parent group element.
This commit is contained in:
Paul Holden
2023-11-23 12:01:24 +00:00
parent b58d1fd4e2
commit b7205c5c84
5 changed files with 24 additions and 13 deletions
+10
View File
@@ -164,6 +164,16 @@ class MoodleQuickForm_group extends HTML_QuickForm_group implements templatable
return call_user_func_array([$this->_mform, 'createElement'], func_get_args());
}
/**
* Return attributes suitable for passing to {@see createFormElement}, comprised of all group attributes without ID in
* order to ensure uniqueness of that value within the group
*
* @return array
*/
public function getAttributesForFormElement(): array {
return array_diff_key((array) $this->getAttributes(), array_flip(['id']));
}
public function export_for_template(renderer_base $output) {
global $OUTPUT;