mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-26964-moodle_url-anchor_master' of git://github.com/mudrd8mz/moodle
This commit is contained in:
commit
3b6d215b91
@ -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);
|
||||
|
||||
|
@ -541,14 +541,21 @@ class moodle_url {
|
||||
|
||||
/**
|
||||
* Returns url without parameters, everything before '?'.
|
||||
*
|
||||
* @param bool $includeanchor if {@link self::anchor} is defined, should it be returned?
|
||||
* @return string
|
||||
*/
|
||||
public function out_omit_querystring() {
|
||||
public function out_omit_querystring($includeanchor = false) {
|
||||
|
||||
$uri = $this->scheme ? $this->scheme.':'.((strtolower($this->scheme) == 'mailto') ? '':'//'): '';
|
||||
$uri .= $this->user ? $this->user.($this->pass? ':'.$this->pass:'').'@':'';
|
||||
$uri .= $this->host ? $this->host : '';
|
||||
$uri .= $this->port ? ':'.$this->port : '';
|
||||
$uri .= $this->path ? $this->path : '';
|
||||
if ($includeanchor and !is_null($this->anchor)) {
|
||||
$uri .= '#' . $this->anchor;
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user