NOBUG: Fixed bug in $PAGE->set_url() when moodle_url passed
When moodle_url was passed as a param to set_url(), the str_replace() kept the leading '/' in the $shorturl. This then led to the <body> classes like '-mod-workshop' instead of correct 'mod-workshop' (the slash replaced with minus sign).
This commit is contained in:
+1
-1
@@ -783,7 +783,7 @@ class moodle_page {
|
||||
public function set_url($url, $params = array()) {
|
||||
global $CFG;
|
||||
if ($url instanceof moodle_url) {
|
||||
$shorturl = str_replace($CFG->wwwroot, '', $url->out(true));
|
||||
$shorturl = str_replace($CFG->wwwroot . '/', '', $url->out(true));
|
||||
$this->_url = clone($url);
|
||||
if (!empty($params)) {
|
||||
throw new coding_exception('Cannot pass params together with moodle_url to moodle_page::set_url().');
|
||||
|
||||
Reference in New Issue
Block a user