MDL-26964 URL anchor support for single_button and single_select

If the single_button or single_select use HTTP method 'get' then the
eventual anchor part of the URL is used.
This commit is contained in:
David Mudrak 2011-03-24 14:25:40 +01:00
parent 5c6ee6ec36
commit a12cd69c9e

View File

@ -1124,7 +1124,11 @@ class core_renderer extends renderer_base {
$output = html_writer::tag('div', $output);
// now the form itself around it
$url = $button->url->out_omit_querystring(); // url without params
if ($button->method === 'get') {
$url = $button->url->out_omit_querystring(true); // url without params, the anchor part allowed
} else {
$url = $button->url->out_omit_querystring(); // url without params, the anchor part not allowed
}
if ($url === '') {
$url = '#'; // there has to be always some action
}
@ -1210,8 +1214,13 @@ class core_renderer extends renderer_base {
$output = html_writer::tag('div', $output);
// now the form itself around it
if ($select->method === 'get') {
$url = $select->url->out_omit_querystring(true); // url without params, the anchor part allowed
} else {
$url = $select->url->out_omit_querystring(); // url without params, the anchor part not allowed
}
$formattributes = array('method' => $select->method,
'action' => $select->url->out_omit_querystring(),
'action' => $url,
'id' => $select->formid);
$output = html_writer::tag('form', $output, $formattributes);