From 65adf66a24e20333443dc59f802d271d893b5d4e Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Mon, 15 Jun 2020 10:34:40 +0800 Subject: [PATCH] MDL-66568 core_output: Return built theme CSS --- lib/outputlib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/outputlib.php b/lib/outputlib.php index f17285e8422..fac626854d0 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -179,12 +179,13 @@ function theme_get_css_filename($themename, $globalrevision, $themerevision, $di * @param theme_config[] $themeconfigs An array of theme_config instances. * @param array $directions Must be a subset of ['rtl', 'ltr']. * @param bool $cache Should the generated files be stored in local cache. + * @return array The built theme content in a multi-dimensional array of name => direction => content */ -function theme_build_css_for_themes($themeconfigs = [], $directions = ['rtl', 'ltr'], $cache = true) { +function theme_build_css_for_themes($themeconfigs = [], $directions = ['rtl', 'ltr'], $cache = true): array { global $CFG; if (empty($themeconfigs)) { - return; + return []; } require_once("{$CFG->libdir}/csslib.php"); @@ -212,7 +213,7 @@ function theme_build_css_for_themes($themeconfigs = [], $directions = ['rtl', 'l css_store_css($themeconfig, $filename, $themecss[$direction]); } } - $themescss[] = $themecss; + $themescss[$themeconfig->name] = $themecss; if ($cache) { // Only update the theme revision after we've successfully created the