MDL-70920 backup: call_user_func_array can accept named arguments

Because arguments names do not match in associative array, we change it to regular array or arguments
This commit is contained in:
Marina Glancy 2021-02-16 22:52:52 +01:00
parent a93828a188
commit 7b003c04a8

View File

@ -207,7 +207,8 @@ abstract class base_moodleform extends moodleform {
$this->add_html_formatting($setting);
// Then call the add method with the get_element_properties array.
call_user_func_array(array($this->_form, 'addElement'), $setting->get_ui()->get_element_properties($task, $OUTPUT));
call_user_func_array(array($this->_form, 'addElement'),
array_values($setting->get_ui()->get_element_properties($task, $OUTPUT)));
$this->_form->setType($setting->get_ui_name(), $setting->get_param_validation());
$defaults[$setting->get_ui_name()] = $setting->get_value();
if ($setting->has_help()) {
@ -335,7 +336,7 @@ abstract class base_moodleform extends moodleform {
$mform = $this->_form;
// Apply all dependencies for backup.
foreach ($setting->get_my_dependency_properties() as $key => $dependency) {
call_user_func_array(array($this->_form, 'disabledIf'), $dependency);
call_user_func_array(array($this->_form, 'disabledIf'), array_values($dependency));
}
}