diff --git a/CHANGES.md b/CHANGES.md index d0047fe78b9021d92101f1aa3beec645abe2a039..0b0b750aafb59a7c4944babc147e4b73cf96a621 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2020-09-24 - Fixed bug that theme Boost Campus Child did not show the favicon set in parent theme Boost Campus. * 2020-06-09 - Improved SCSS settings to be used with admin_setting_scsscode that validates the code before saving. ### v3.8-r1 diff --git a/classes/output/core_renderer.php b/classes/output/core_renderer.php new file mode 100644 index 0000000000000000000000000000000000000000..6437a15c75f42350c315c92c34249a0916dc57ba --- /dev/null +++ b/classes/output/core_renderer.php @@ -0,0 +1,72 @@ +<?php +// This file is part of Moodle - http://moodle.org/ +// +// Moodle is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Moodle is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see <http://www.gnu.org/licenses/>. + +/** + * Renderers to align Moodle's HTML with that expected by Bootstrap + * + * @package theme_boost_campus_child + * @copyright 2017 Kathrin Osswald, Ulm University kathrin.osswald@uni-ulm.de + * copyright based on code from theme_boost by Bas Brands + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace theme_boost_campus_child\output; + +use moodle_url; +use theme_config; + +defined('MOODLE_INTERNAL') || die; + + +/** + * Extending the core_renderer interface. + * + * @copyright 2020 Kathrin Osswald, Ulm University kathrin.osswald@uni-ulm.de + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package theme_boost_campus_child + * @category output + */ +class core_renderer extends \core_renderer { + + /** + * Override to be able to use uploaded images from admin_setting as well. + * + * Returns the moodle_url for the favicon. + * + * KIZ MODIFICATION: This renderer function is copied and modified from /lib/outputrenderers.php + * + * @since Moodle 2.5.1 2.6 + * @return moodle_url The moodle_url for the favicon + */ + public function favicon() { + // MODIFICATION START. + // Get the theme Boost Campus config. + $bcconfig = theme_config::load('boost_campus'); + // Get the theme Boost Campus favicon setting. + $bcconffavicon = get_config('theme_boost_campus', 'favicon'); + if (!empty($bcconffavicon)) { + // Return the image that was saved in the theme Boost Campus favicon setting. + return $bcconfig->setting_file_url('favicon', 'favicon'); + } else { + // Return the icon stored in boost_campus/pix folder. + return $bcconfig->image_url('favicon', 'theme'); + } + // MODIFICATION END. + /* ORIGINAL START. + return $this->image_url('favicon', 'theme'); + ORIGINAL END. */ + } +}