MDL-59112 theme_clean: Always return expected moodle_url
The function was returned some times a moodle_url object and another times just a string with a relative URL.
This commit is contained in:
@@ -130,8 +130,14 @@ class theme_clean_core_renderer extends theme_bootstrapbase_core_renderer {
|
||||
* @return moodle_url|false
|
||||
*/
|
||||
public function get_logo_url($maxwidth = null, $maxheight = 100) {
|
||||
global $CFG;
|
||||
|
||||
if (!empty($this->page->theme->settings->logo)) {
|
||||
return $this->page->theme->setting_file_url('logo', 'logo');
|
||||
$url = $this->page->theme->setting_file_url('logo', 'logo');
|
||||
// Get a URL suitable for moodle_url.
|
||||
$relativebaseurl = preg_replace('|^https?://|i', '//', $CFG->wwwroot);
|
||||
$url = str_replace($relativebaseurl, '', $url);
|
||||
return new moodle_url($url);
|
||||
}
|
||||
return parent::get_logo_url($maxwidth, $maxheight);
|
||||
}
|
||||
@@ -146,8 +152,14 @@ class theme_clean_core_renderer extends theme_bootstrapbase_core_renderer {
|
||||
* @return moodle_url|false
|
||||
*/
|
||||
public function get_compact_logo_url($maxwidth = 100, $maxheight = 100) {
|
||||
global $CFG;
|
||||
|
||||
if (!empty($this->page->theme->settings->smalllogo)) {
|
||||
return $this->page->theme->setting_file_url('smalllogo', 'smalllogo');
|
||||
$url = $this->page->theme->setting_file_url('smalllogo', 'smalllogo');
|
||||
// Get a URL suitable for moodle_url.
|
||||
$relativebaseurl = preg_replace('|^https?://|i', '//', $CFG->wwwroot);
|
||||
$url = str_replace($relativebaseurl, '', $url);
|
||||
return new moodle_url($url);
|
||||
}
|
||||
return parent::get_compact_logo_url($maxwidth, $maxheight);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user