From bafe272847cb5f6ccdc0c8b341e8f6e3efd8ae27 Mon Sep 17 00:00:00 2001 From: Alexander Bias <bias@alexanderbias.de> Date: Thu, 3 Nov 2022 21:25:41 +0100 Subject: [PATCH] Bugfix: Return Boost Campus favicon as moodle_url instead of string, solves #120 --- CHANGES.md | 1 + classes/output/core_renderer.php | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 783901f..92ccfe6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2022-11-03 - Bugfix: Return Boost Campus favicon as moodle_url instead of string, solves #120. * 2022-07-10 - Add Capabilities section to README.md ### v3.11-r3 diff --git a/classes/output/core_renderer.php b/classes/output/core_renderer.php index dcd8a5c..1807bf5 100644 --- a/classes/output/core_renderer.php +++ b/classes/output/core_renderer.php @@ -46,6 +46,7 @@ use paging_bar; use url_select; use context_course; use pix_icon; +use context_system; /** * Extending the core_renderer interface. @@ -97,14 +98,21 @@ class core_renderer extends \core_renderer { * * @since Moodle 2.5.1 2.6 * @return moodle_url The moodle_url for the favicon + * @throws \moodle_exception */ public function favicon() { // MODIFICATION START. - if (!empty($this->page->theme->settings->favicon)) { - return $this->page->theme->setting_file_url('favicon', 'favicon'); - } else { + $logo = null; + if (!during_initial_install()) { + $logo = get_config('theme_boost_campus', 'favicon'); + } + if (empty($logo)) { return $this->image_url('favicon', 'theme'); } + + // Use $CFG->themerev to prevent browser caching when the file changes. + return moodle_url::make_pluginfile_url(context_system::instance()->id, 'theme_boost_campus', 'favicon', '', + theme_get_revision(), $logo); // MODIFICATION END. // @codingStandardsIgnoreStart /* ORIGINAL START. -- GitLab