MDL-48160 theme: Improve all block region layouts when coded for RTL.

This commit is contained in:
Mary Evans 2015-02-03 18:19:14 +00:00
parent 4c27f52d91
commit 73b425be07
12 changed files with 148 additions and 69 deletions

View file

@ -46,8 +46,3 @@ $THEME->editor_sheets = array();
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
$THEME->csspostprocess = 'theme_clean_process_css';
$THEME->blockrtlmanipulations = array(
'side-pre' => 'side-post',
'side-post' => 'side-pre'
);

View file

@ -25,7 +25,15 @@
// Get the HTML for the settings bits.
$html = theme_clean_get_html_for_settings($OUTPUT, $PAGE);
$left = (!right_to_left()); // To know if to add 'pull-right' and 'desktop-first-column' classes in the layout for LTR.
// Set default (LTR) layout mark-up for a two column page (side-pre-only).
$regionmain = 'span9 pull-right';
$sidepre = 'span3 desktop-first-column';
// Reset layout mark-up for RTL languages.
if (right_to_left()) {
$regionmain = 'span9';
$sidepre = 'span3 pull-right';
}
echo $OUTPUT->doctype() ?>
<html <?php echo $OUTPUT->htmlattributes(); ?>>
<head>
@ -75,19 +83,14 @@ echo $OUTPUT->doctype() ?>
</header>
<div id="page-content" class="row-fluid">
<section id="region-main" class="span9<?php if ($left) { echo ' pull-right'; } ?>">
<section id="region-main" class="<?php echo $regionmain; ?>">
<?php
echo $OUTPUT->course_content_header();
echo $OUTPUT->main_content();
echo $OUTPUT->course_content_footer();
?>
</section>
<?php
$classextra = '';
if ($left) {
$classextra = ' desktop-first-column';
}
echo $OUTPUT->blocks('side-pre', 'span3'.$classextra);
<?php echo $OUTPUT->blocks('side-pre', $sidepre);
?>
</div>

View file

@ -31,10 +31,17 @@
// Get the HTML for the settings bits.
$html = theme_clean_get_html_for_settings($OUTPUT, $PAGE);
// Set default (LTR) layout mark-up for a three column page.
$regionmainbox = 'span9';
$regionmain = 'span8 pull-right';
$sidepre = 'span4 desktop-first-column';
$sidepost = 'span3 pull-right';
// Reset layout mark-up for RTL languages.
if (right_to_left()) {
$regionbsid = 'region-bs-main-and-post';
} else {
$regionbsid = 'region-bs-main-and-pre';
$regionmainbox = 'span9 pull-right';
$regionmain = 'span8';
$sidepre = 'span4 pull-right';
$sidepost = 'span3 desktop-first-column';
}
echo $OUTPUT->doctype() ?>
@ -86,19 +93,19 @@ echo $OUTPUT->doctype() ?>
</header>
<div id="page-content" class="row-fluid">
<div id="<?php echo $regionbsid ?>" class="span9">
<div id="region-main-box" class="<?php echo $regionmainbox; ?>">
<div class="row-fluid">
<section id="region-main" class="span8 pull-right">
<section id="region-main" class="<?php echo $regionmain; ?>">
<?php
echo $OUTPUT->course_content_header();
echo $OUTPUT->main_content();
echo $OUTPUT->course_content_footer();
?>
</section>
<?php echo $OUTPUT->blocks('side-pre', 'span4 desktop-first-column'); ?>
<?php echo $OUTPUT->blocks('side-pre', $sidepre); ?>
</div>
</div>
<?php echo $OUTPUT->blocks('side-post', 'span3'); ?>
<?php echo $OUTPUT->blocks('side-post', $sidepost); ?>
</div>
<footer id="page-footer">

View file

@ -25,6 +25,19 @@
// Get the HTML for the settings bits.
$html = theme_clean_get_html_for_settings($OUTPUT, $PAGE);
// Set default (LTR) layout mark-up for a three column page.
$regionmainbox = 'span9';
$regionmain = 'span8 pull-right';
$sidepre = 'span4 desktop-first-column';
$sidepost = 'span3 pull-right';
// Reset layout mark-up for RTL languages.
if (right_to_left()) {
$regionmainbox = 'span9 pull-right';
$regionmain = 'span8';
$sidepre = 'span4 pull-right';
$sidepost = 'span3 desktop-first-column';
}
echo $OUTPUT->doctype() ?>
<html <?php echo $OUTPUT->htmlattributes(); ?>>
<head>
@ -65,15 +78,15 @@ echo $OUTPUT->doctype() ?>
</header>
<div id="page-content" class="row-fluid">
<div id="region-bs-main-and-pre" class="span9">
<div id="region-main-box" class="<?php echo $regionmainbox; ?>">
<div class="row-fluid">
<section id="region-main" class="span8 pull-right">
<section id="region-main" class="<?php echo $regionmain; ?>">
<?php echo $OUTPUT->main_content(); ?>
</section>
<?php echo $OUTPUT->blocks('side-pre', 'span4 desktop-first-column'); ?>
<?php echo $OUTPUT->blocks('side-pre', $sidepre); ?>
</div>
</div>
<?php echo $OUTPUT->blocks('side-post', 'span3'); ?>
<?php echo $OUTPUT->blocks('side-post', $sidepost); ?>
</div>
<?php echo $OUTPUT->standard_end_of_body_html() ?>