diff --git a/CHANGES.md b/CHANGES.md index 78287814a92..511eb99e908 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,8 @@ moodle-theme_boost_union Changes ------- +* 2023-03-17 - Improvement: Do not force child themes to copy theme settings, but allow it. + ### v4.1-r4 * 2023-03-06 - Bugfix: Align the search bar with the dark navbar look, solves #234. diff --git a/locallib.php b/locallib.php index 73282e996ea..e89dc6f1e4a 100644 --- a/locallib.php +++ b/locallib.php @@ -1313,3 +1313,20 @@ function theme_boost_union_set_mobilecss_url() { set_config('mobilecssurl', ''); } } + +/** + * Checks if the current theme (Boost Union or a child theme of it) has the requested setting. + * If it does, returns that setting's value. + * If it doesn't, returns the value of Boost Union's setting. + * @param string $setting - Name of the setting + * @return mixed + */ +function theme_boost_union_get_setting(string $setting) { + global $PAGE; + if ($PAGE->theme->settings->{$setting}) { + $value = $PAGE->theme->settings->{$setting}; + } else { + $value = get_config('theme_boost_union', $setting); + } + return $value; +}