From a9a1791fe7939fe9fc094161f280ef404e428667 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 5 Aug 2022 14:04:14 +0800 Subject: [PATCH] MDL-75386 theme: Include CSS from editor subplugins in editor style Editor stylesheets are kept separately to standard plugin stylesheets so that they can be provided to style individual iframes where loading the standard Moodle stylesheets would be incorrect. Unfortunately the editor stylesheet system does not consider that subplugins may want to add small individual styling to the editor but this is required in some situations. --- lib/outputlib.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/outputlib.php b/lib/outputlib.php index 8694fa7c7f1..f44c12e9c18 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -957,12 +957,25 @@ class theme_config { // First editor plugins. $plugins = core_component::get_plugin_list('editor'); - foreach ($plugins as $plugin=>$fulldir) { + foreach ($plugins as $plugin => $fulldir) { $sheetfile = "$fulldir/editor_styles.css"; if (is_readable($sheetfile)) { $files['plugin_'.$plugin] = $sheetfile; } + + $subplugintypes = core_component::get_subplugins("editor_{$plugin}"); + // Fetch sheets for any editor subplugins. + foreach ($subplugintypes as $plugintype => $subplugins) { + foreach ($subplugins as $subplugin) { + $plugindir = core_component::get_plugin_directory($plugintype, $subplugin); + $sheetfile = "{$plugindir}/editor_styles.css"; + if (is_readable($sheetfile)) { + $files["{$plugintype}_{$subplugin}"] = $sheetfile; + } + } + } } + // Then parent themes - base first, the immediate parent last. foreach (array_reverse($this->parent_configs) as $parent_config) { if (empty($parent_config->editor_sheets)) {