Permalink
Browse files

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.
  • Loading branch information...
1 parent 4927443 commit dbe6d9f8212f2f8c1f8f339800fcee28c3530395 @mudrd8mz mudrd8mz committed Mar 24, 2011
Showing with 11 additions and 2 deletions.
  1. +11 −2 lib/outputrenderers.php
@@ -1124,7 +1124,11 @@ protected function render_single_button(single_button $button) {
$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 @@ protected function render_single_select(single_select $select) {
$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);

0 comments on commit dbe6d9f

Please sign in to comment.