diff --git a/lib/outputlib.php b/lib/outputlib.php index f44c12e9c18..119a8f0b503 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -925,6 +925,11 @@ class theme_config { public function editor_css_url($encoded=true) { global $CFG; $rev = theme_get_revision(); + $type = 'editor'; + if (right_to_left()) { + $type .= '-rtl'; + } + if ($rev > -1) { $themesubrevision = theme_get_sub_revision_for_theme($this->name); @@ -936,13 +941,19 @@ class theme_config { $url = new moodle_url("/theme/styles.php"); if (!empty($CFG->slasharguments)) { - $url->set_slashargument('/'.$this->name.'/'.$rev.'/editor', 'noparam', true); + $url->set_slashargument("{$this->name}/{$rev}/{$type}", 'noparam', true); } else { - $url->params(array('theme'=>$this->name,'rev'=>$rev, 'type'=>'editor')); + $url->params([ + 'theme' => $this->name, + 'rev' => $rev, + 'type' => $type, + ]); } } else { - $params = array('theme'=>$this->name, 'type'=>'editor'); - $url = new moodle_url('/theme/styles_debug.php', $params); + $url = new moodle_url('/theme/styles_debug.php', [ + 'theme' => $this->name, + 'type' => $type, + ]); } return $url; } diff --git a/theme/styles.php b/theme/styles.php index 2b25d142401..c64eb6546bc 100644 --- a/theme/styles.php +++ b/theme/styles.php @@ -67,7 +67,7 @@ if (!is_null($themesubrev)) { } // Check that type fits into the expected values. -if (!in_array($type, ['all', 'all-rtl', 'editor'])) { +if (!in_array($type, ['all', 'all-rtl', 'editor', 'editor-rtl'])) { css_send_css_not_found(); } @@ -103,7 +103,7 @@ require("$CFG->dirroot/lib/setup.php"); $theme = theme_config::load($themename); $theme->force_svg_use($usesvg); -$theme->set_rtl_mode($type === 'all-rtl' ? true : false); +$theme->set_rtl_mode(substr($type, -4) === '-rtl'); $themerev = theme_get_revision(); $currentthemesubrev = theme_get_sub_revision_for_theme($themename); @@ -125,7 +125,7 @@ if ($themerev <= 0 or $themerev != $rev or $themesubrev != $currentthemesubrev) make_localcache_directory('theme', false); -if ($type === 'editor') { +if ($type === 'editor' || $type === 'editor-rtl') { $csscontent = $theme->get_css_content_editor(); if ($cache) {