MDL-77148 core: Fix to export params for templates in correct format

When questions are filtered by tags in the question bank, the qtagids
params are passed in the array format. Though moodle_url handles this,
single_button::export_for_template cannot. Hence changes done in
weblib.php to provide params for export_for_template in the
suitable format.
Thanks Huong. I have added the Behat test you provided in the patch.
This commit is contained in:
Anupama Sarjoshi
2023-04-06 13:57:40 +01:00
parent 8400206468
commit 6bee956ede
5 changed files with 116 additions and 17 deletions
+4 -14
View File
@@ -921,13 +921,8 @@ class single_button implements renderable {
}
// Form parameters.
$params = $this->url->params();
if ($this->method === 'post') {
$params['sesskey'] = sesskey();
}
$data->params = array_map(function($key) use ($params) {
return ['name' => $key, 'value' => $params[$key]];
}, array_keys($params));
$actionurl = new moodle_url($this->url, ['sesskey' => sesskey()]);
$data->params = $actionurl->export_params_for_template();
// Button actions.
$actions = $this->actions;
@@ -1129,13 +1124,8 @@ class single_select implements renderable, templatable {
}, array_keys($attributes));
// Form parameters.
$params = $this->url->params();
if ($this->method === 'post') {
$params['sesskey'] = sesskey();
}
$data->params = array_map(function($key) use ($params) {
return ['name' => $key, 'value' => $params[$key]];
}, array_keys($params));
$actionurl = new moodle_url($this->url, ['sesskey' => sesskey()]);
$data->params = $actionurl->export_params_for_template();
// Select options.
$hasnothing = false;