MDL-65438 core_themes: allow themes to change the css url
authorBas Brands <bas@moodle.com>
Mon, 29 Apr 2019 09:57:16 +0000 (11:57 +0200)
committerBas Brands <bas@moodle.com>
Wed, 8 May 2019 13:20:53 +0000 (15:20 +0200)
Themes that have the function theme_themename_alter_css_urls() in lib.php
can change the css url from theme/styles.php to a local script like
theme/themename/css.php. The local css.php file can be used to serve
various versions of the theme css, for example versions compiled using
different scss variables.

lib/outputlib.php

index a62786a..745a33c 100644 (file)
@@ -1103,6 +1103,8 @@ class theme_config {
             }
         }
 
+        // Allow themes to change the css url to something like theme/mytheme/mycss.php.
+        component_callback('theme_' . $this->name, 'alter_css_urls', [&$urls]);
         return $urls;
     }