From 197aac357ef38f002cf0e7b9911aa10b405585f7 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Sat, 24 Aug 2024 00:57:34 +0800 Subject: [PATCH] MDL-82740 core: Check for monologo icons in theme overrides --- lib/classes/component.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/classes/component.php b/lib/classes/component.php index 83365ab4447..8bb65eec11b 100644 --- a/lib/classes/component.php +++ b/lib/classes/component.php @@ -1557,10 +1557,15 @@ $cache = '.var_export($cache, true).'; * @return bool True if the plugin has a monologo icon */ public static function has_monologo_icon(string $plugintype, string $pluginname): bool { - $plugindir = core_component::get_plugin_directory($plugintype, $pluginname); + global $PAGE; + $plugindir = self::get_plugin_directory($plugintype, $pluginname); if ($plugindir === null) { return false; } - return file_exists("$plugindir/pix/monologo.svg") || file_exists("$plugindir/pix/monologo.png"); + $theme = \theme_config::load($PAGE->theme->name); + $component = self::normalize_componentname("{$plugintype}_{$pluginname}"); + $hassvgmonologo = $theme->resolve_image_location('monologo', $component, true) !== null; + $haspngmonologo = $theme->resolve_image_location('monologo', $component) !== null; + return $haspngmonologo || $hassvgmonologo; } }