Skip to content

Commit

Permalink
MDL-82740 core: Check for monologo icons in theme overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Sep 19, 2024
1 parent 62c4f8a commit ad913b6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/classes/component.php
Original file line number Diff line number Diff line change
Expand Up @@ -1566,10 +1566,15 @@ public static function get_core_api_names(): array {
* @return bool True if the plugin has a monologo icon
*/
public static function has_monologo_icon(string $plugintype, string $pluginname): bool {
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;
}
}

0 comments on commit ad913b6

Please sign in to comment.