From b3e1e2d0073abfcd842a936ea4e3019998fb56f4 Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Tue, 19 May 2015 13:18:30 +0200 Subject: [PATCH] MDL-50271 webservices: Allow to load multiple themes in WS_SERVER mode --- lib/pagelib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/pagelib.php b/lib/pagelib.php index 0c0e99b2944..d1a5d780601 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -1828,6 +1828,11 @@ class moodle_page { * @throws coding_exception */ protected function ensure_theme_not_set() { + // This is explicitly allowed for webservices though which may process many course contexts in a single request. + if (WS_SERVER) { + return; + } + if (!is_null($this->_theme)) { throw new coding_exception('The theme has already been set up for this page ready for output. ' . 'Therefore, you can no longer change the theme, or anything that might affect what ' .