MDL-55224 output: Support automatic flipping to RTL styles

Part of MDL-55071
This commit is contained in:
Frederic Massart
2016-09-23 10:49:49 +01:00
committed by Dan Poltawski
parent fbe18cc022
commit 1d987cae5f
5 changed files with 206 additions and 16 deletions
+4 -2
View File
@@ -37,6 +37,7 @@ $subtype = optional_param('subtype', '', PARAM_SAFEDIR);
$sheet = optional_param('sheet', '', PARAM_SAFEDIR);
$usesvg = optional_param('svg', 1, PARAM_BOOL);
$chunk = optional_param('chunk', null, PARAM_INT);
$rtl = optional_param('rtl', false, PARAM_BOOL);
if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
// The theme exists in standard location - ok.
@@ -48,6 +49,7 @@ if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
$theme = theme_config::load($themename);
$theme->force_svg_use($usesvg);
$theme->set_rtl_mode($rtl);
if ($type === 'editor') {
$csscontent = $theme->get_css_content_editor();
@@ -55,11 +57,11 @@ if ($type === 'editor') {
}
$chunkurl = new moodle_url($CFG->httpswwwroot . '/theme/styles_debug.php', array('theme' => $themename,
'type' => $type, 'subtype' => $subtype, 'sheet' => $sheet, 'usesvg' => $usesvg));
'type' => $type, 'subtype' => $subtype, 'sheet' => $sheet, 'usesvg' => $usesvg, 'rtl' => $rtl));
// We need some kind of caching here because otherwise the page navigation becomes
// way too slow in theme designer mode. Feel free to create full cache definition later...
$key = "$type $subtype $sheet $usesvg";
$key = "$type $subtype $sheet $usesvg $rtl";
$cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'core', 'themedesigner', array('theme' => $themename));
if ($content = $cache->get($key)) {
if ($content['created'] > time() - THEME_DESIGNER_CACHE_LIFETIME) {