Details
-
Sub-task
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
2.5, 2.6
-
MOODLE_25_STABLE, MOODLE_26_STABLE
-
MOODLE_25_STABLE
-
wip-
MDL-40065-master_4 -
Description
As requested by damyon, this is now a late addition to MDL-39824 as it ha been integrated. It does solve the original issue too and impoves the solution in MDL-39824 with less code changes and smaller layout files.
Old description:
There is an error in the logic of bootstrapbase and clean themes layout. general.php which results in side-pre always being output, even if the $THEME->layouts for the page affected excludes side-pre.
Lines 143-162 have the error in bootstrapbase/layout/general.php, and lines 172 to 202 have the error in the clean theme.
The logic error is that the code tests to see if $layout is not content-only. If true then the code renders the html for pre-and-post or for side-pre-only, and drops by error into "if (!right_to_left())" regardless of what $layout is set to.
Therefore if $layout is set to side-post-only there is no HTML code generated, but "echo $OUTPUT->blocks_for_region('side-pre')" is executed regardless.
One possible fix is to change
if (!right_to_left()) {
|
echo $OUTPUT->blocks_for_region('side-pre');
|
} else if ($hassidepost) {
|
echo $OUTPUT->blocks_for_region('side-post');
|
} ?>
|
to
if(!$layout === 'side-post-only') {
|
if (!right_to_left()) {
|
echo $OUTPUT->blocks_for_region('side-pre');
|
} else if ($hassidepost) {
|
echo $OUTPUT->blocks_for_region('side-post');
|
}
|
}
|
However, it is probably better to fix the logic completely so that the echo $OUTPUT->blocks_for_region only occurs when $layout is 'pre-and-post' or 'side-pre-only'
How to test:
Turn on Debug to Developer and Theme Design Mode on
Copy the entire section of $THEME->layouts from bootstrapbase/config.php and paste into config.php of clean/config.php
In config.php of theme standard, and theme clean (please alter both!), change the front page layout to:
// The site home page.
|
'frontpage' => array(
|
'file' => 'general_frontpage.php',
|
'regions' => array('side-pre'),
|
'defaultregion' => 'side-pre',
|
'options' => array('nonavbar'=>true),
|
Purge caches after saving the two config.php files
Select Site Admininstration / Appearance / Theme / Theme Selector and select Clean theme. Go to the front page (ALL should be OK)
Select Site Admininstration / Appearance / Theme / Theme Selector and select Standard theme. Go to the home page (ALL should be OK)
Re edit the two config.php $THEME->layout to:
// The site home page.
|
'frontpage' => array(
|
'file' => 'general_frontpage.php',
|
'regions' => array('side-post'),
|
'defaultregion' => 'side-post',
|
'options' => array('nonavbar'=>true),
|
Purge caches again
Go to front page - all is still OK
Select Site Admininstration / Appearance / Theme / Theme Selector and select Clean theme. Go to the front page
Now you get the Theme header but before you get to the main body Moodle throws an exception - "Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-pre"
Fix the logic error in clean/layout/general.php
Purge all caches
The error should be corrected.
NOTE: There appears to be another bug but I will raise a second issue for that one. The problem is, if blocks are configured to appear in side-post, then when the $THEME-layout for a page says only use side-pre, the blocks disappear when using theme Clean. This doesn't happen with theme Standard. Please link this other issue as it may be related.
Attachments
Issue Links
- blocks
-
MDL-40204 Bootstrap three column layout does not render correctly in RTL when only one block.
-
- Closed
-
- caused a regression
-
MDL-41055 ADD a side-post-only layout to Bootstrapbase
-
- Closed
-
- is blocked by
-
MDL-39824 Simplification of themes
-
- Closed
-
- will be (partly) resolved by
-
MDL-40971 Importing Outcomes breaks Clean theme
-
- Closed
-
- will help resolve
-
MDL-40067 Bootstrap Clean Theme loses blocks when $THEME->layout side-pre and side-post are swapped
-
- Closed
-
-
MDL-40774 Coding Error when logging in as admin to site using Clean theme
-
- Closed
-