diff --git a/classes/local/controllers/infopage.php b/classes/local/controllers/infopage.php index 4c691d4..a1be30e 100644 --- a/classes/local/controllers/infopage.php +++ b/classes/local/controllers/infopage.php @@ -53,6 +53,11 @@ class infopage { * @param array $params Parameters to use or null to get from Moodle API (request). */ public function __construct(array $params = null) { + global $CFG; + // Enable SVG support here to make sure all SVG files + // used in the current theme are served properly. + $CFG->svgicons = true; + if (is_null($params)) { $params = [ 'id' => optional_param('id', null, PARAM_INT), diff --git a/tests/phpunit/local/controllers/infopage_test.php b/tests/phpunit/local/controllers/infopage_test.php index 1041175..9c3bc5a 100644 --- a/tests/phpunit/local/controllers/infopage_test.php +++ b/tests/phpunit/local/controllers/infopage_test.php @@ -106,4 +106,14 @@ class infopagecontroller_test extends auth_outage_base_testcase { $output = $info->get_output(); self::assertContains('auth_outage_info', $output); } + + /** + * Tests the constructor enables SVG support. + */ + public function test_svgicons_is_true() { + global $CFG; + $CFG->svgicons = false; + new infopage(); + self::assertTrue($CFG->svgicons); + } }