mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-19756 Fixed regression in popup_form()
This commit is contained in:
parent
b0a5e1bf59
commit
0affac4d65
3 changed files with 26 additions and 19 deletions
|
@ -3339,22 +3339,22 @@ function popup_form($baseurl, $options, $formid, $selected='', $nothing='choose'
|
|||
|
||||
// debugging('popup_form() has been deprecated. Please change your code to use $OUTPUT->select($dateselector).');
|
||||
|
||||
if (!empty($optionsextra)) {
|
||||
debugging('the optionsextra param has been deprecated in popup_form, it will be ignored.', DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
if (empty($options)) {
|
||||
return '';
|
||||
}
|
||||
$select = moodle_select::make_popup_form($baseurl, $options, $formid, $submitvalue, $selected);
|
||||
$select->disabled = $disabled;
|
||||
|
||||
// Extract the last param of the baseurl for the name of the select
|
||||
if (preg_match('/([a-z_]*)=$/', $baseurl, $matches)) {
|
||||
$select->name = $matches[1];
|
||||
$select->form->url->remove_params(array($matches[1]));
|
||||
foreach ($options as $var => $val) {
|
||||
$url = new moodle_url($baseurl . $var);
|
||||
if (!empty($optionsextra[$var])) {
|
||||
new moodle_url($baseurl . $var . $optionsextra[$var]);
|
||||
}
|
||||
$options[$url->out(false, array(), false)] = $val;
|
||||
unset($options[$var]);
|
||||
}
|
||||
|
||||
$select = moodle_select::make_popup_form($options, $formid, $submitvalue, $selected);
|
||||
$select->disabled = $disabled;
|
||||
|
||||
if ($nothing == 'choose') {
|
||||
$select->nothinglabel = '';
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue