MDL-77105 core: Method to determine whether a plugin has monolog icons
This commit is contained in:
@@ -1282,4 +1282,22 @@ $cache = '.var_export($cache, true).';
|
||||
}
|
||||
return $componentnames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for the presence of monologo icons within a plugin.
|
||||
*
|
||||
* Only checks monologo icons in PNG and SVG formats as they are
|
||||
* formats that can have transparent background.
|
||||
*
|
||||
* @param string $plugintype The plugin type.
|
||||
* @param string $pluginname The plugin name.
|
||||
* @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);
|
||||
if ($plugindir === null) {
|
||||
return false;
|
||||
}
|
||||
return file_exists("$plugindir/pix/monologo.svg") || file_exists("$plugindir/pix/monologo.png");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user