diff --git a/CHANGES.txt b/CHANGES.txt index 84e4cb53..55ef138f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,7 @@ New in 3.1.1.6 ============== - FIX: Issue #798: Slider title needs to support multi-lang filter. - FIX: Course category multi-lang, ref: https://moodle.org/mod/forum/discuss.php?d=344426#p1389008. +- NEW: Issue #734: Unable to disable the new "page top" block region. New in 3.1.1.5 ============== diff --git a/classes/toolbox.php b/classes/toolbox.php index 2bafb30e..a03af28b 100644 --- a/classes/toolbox.php +++ b/classes/toolbox.php @@ -158,7 +158,7 @@ static private function check_corerenderer() { global $PAGE; $corerenderer = null; try { - $corerenderer = $PAGE->get_renderer('theme_'.$PAGE->theme->name, 'core'); + $corerenderer = $PAGE->get_renderer('theme_'.$page->theme->name, 'core'); } catch (\coding_exception $ce) { // Specialised renderer may not exist in theme. This is not a coding fault. We just need to cope. $corerenderer = null; diff --git a/config.php b/config.php index 526792af..2dfc5fa8 100644 --- a/config.php +++ b/config.php @@ -72,13 +72,18 @@ $baseregions[] = 'header'; $fpaddregions[] = 'header'; } -$standardregions = array_merge(array('side-pre', 'page-top'), $baseregions); +$onecolumnregions = array_merge($baseregions); +$standardregions = array_merge(array('side-pre'), $baseregions); +if (get_config('theme_essential', 'pagetopblocks')) { + $onecolumnregions[] = 'page-top'; + $standardregions[] = 'page-top'; +} $THEME->layouts = array( // Most backwards compatible layout without the blocks - this is the layout used by default. 'base' => array( 'file' => 'columns1.php', - 'regions' => $baseregions, + 'regions' => $onecolumnregions, 'defaultregion' => 'footer-middle', ), // Front page. @@ -164,7 +169,7 @@ // Should display the content and basic headers only. 'print' => array( 'file' => 'columns1.php', - 'regions' => $baseregions, + 'regions' => $onecolumnregions, 'defaultregion' => '', 'options' => array('nofooter' => true), ), diff --git a/lang/en/theme_essential.php b/lang/en/theme_essential.php index 5c6a456b..a93b063f 100644 --- a/lang/en/theme_essential.php +++ b/lang/en/theme_essential.php @@ -168,8 +168,10 @@ $string['stylestretch'] = 'Stretch'; $string['styletiled'] = 'Tiled'; +$string['pagetopblocks'] = 'Enable additional page \'Page top\' blocks'; +$string['pagetopblocksdesc'] = 'If enabled this will display an additional block location beside the side blocks and above the content area on all pages except the \'Front page\' which has its own setting. Note: The number of blocks per row depends on the setting \'pagetopblocksperrow\'.'; $string['pagetopblocksperrow'] = 'Page top blocks per row'; -$string['pagetopblocksperrowdesc'] = 'State up to how many blocks per row between {$a->lower} and {$a->upper} for pages with \'Page top blocks\'. Current pages are: Admin, Course, Course Category, Dashboard, Frontpage, My Public.'; +$string['pagetopblocksperrowdesc'] = 'State up to how many blocks per row between {$a->lower} and {$a->upper} for pages with \'Page top blocks\'. Current pages are: Course, Course Category, Dashboard, My Public and Print.'; $string['pagebottomblocksperrow'] = 'Page bottom blocks per row'; $string['pagebottomblocksperrowdesc'] = 'State up to how many blocks per row between {$a->lower} and {$a->upper} for pages with \'Page bottom blocks\'. Current pages are: Admin, Course management, Grading and Quiz edit.'; @@ -455,9 +457,11 @@ $string['frontpagemiddleblocks'] = 'Enable additional front page \'Home\' (was \'Middle\') blocks'; $string['frontpagemiddleblocksdesc'] = 'If enabled this will display an additional block location just under the marketing spots.'; $string['frontpagehomeblocksperrow'] = 'Home (was \'Middle\') blocks per row'; -$string['frontpagehomeblocksperrowdesc'] = 'State up to how many blocks per row between {$a->lower} and {$a->upper} for the \'Home blocks\'.'; +$string['frontpagehomeblocksperrowdesc'] = 'State up to how many blocks per row between {$a->lower} and {$a->upper} for the \'Home blocks\' block region.'; $string['fppagetopblocks'] = 'Enable additional front page \'Page top\' blocks'; -$string['fppagetopblocksdesc'] = 'If enabled this will display an additional block location beside the side blocks and above the content area. Note: The number of blocks per row depends on the setting \'pagetopblocksperrow\'.'; +$string['fppagetopblocksdesc'] = 'If enabled this will display an additional block location beside the side blocks and above the content area. Note: The number of blocks per row depends on the setting \'fppagetopblocksperrow\'.'; +$string['fppagetopblocksperrow'] = 'Page top blocks per row'; +$string['fppagetopblocksperrowdesc'] = 'State up to how many blocks per row between {$a->lower} and {$a->upper} for the \'Page top\' block region on the front page.'; // Slideshow. $string['slideshowheading'] = 'Slide show'; diff --git a/layout/columns1.php b/layout/columns1.php index 4ce2a0ea..006d1f3d 100644 --- a/layout/columns1.php +++ b/layout/columns1.php @@ -33,12 +33,16 @@
- course_title(); ?> - course_content_header(); ?> - main_content(); ?> - layout_options['nocoursefooter'])) { + essential_blocks('page-top', 'row-fluid', 'aside', 'pagetopblocksperrow'); + } + echo $OUTPUT->course_title(); + echo $OUTPUT->course_content_header(); + echo $OUTPUT->main_content(); + if (empty($PAGE->layout_options['nocoursefooter'])) { echo $OUTPUT->course_content_footer(); -} + } ?>
diff --git a/layout/columns3.php b/layout/columns3.php index 67f6a59c..5941cedb 100644 --- a/layout/columns3.php +++ b/layout/columns3.php @@ -42,7 +42,9 @@ } else { echo '
'; } -echo $OUTPUT->essential_blocks('page-top', 'row-fluid', 'aside', 'pagetopblocksperrow'); +if (\theme_essential\toolbox::get_setting('pagetopblocks')) { + echo $OUTPUT->essential_blocks('page-top', 'row-fluid', 'aside', 'pagetopblocksperrow'); +} echo '
'; echo $OUTPUT->course_title(); echo $OUTPUT->course_content_header(); diff --git a/layout/tiles/fppagetopblocks.php b/layout/tiles/fppagetopblocks.php index c6887105..de032d7f 100644 --- a/layout/tiles/fppagetopblocks.php +++ b/layout/tiles/fppagetopblocks.php @@ -22,4 +22,4 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -echo $OUTPUT->essential_blocks('page-top', 'row-fluid', 'aside', 'pagetopblocksperrow'); +echo $OUTPUT->essential_blocks('page-top', 'row-fluid', 'aside', 'fppagetopblocksperrow'); diff --git a/layout/tiles/twocolumncontent.php b/layout/tiles/twocolumncontent.php index 4ab359ef..691f4180 100644 --- a/layout/tiles/twocolumncontent.php +++ b/layout/tiles/twocolumncontent.php @@ -30,7 +30,9 @@ } else { echo '
'; } -echo $OUTPUT->essential_blocks('page-top', 'row-fluid', 'aside', 'pagetopblocksperrow'); +if (\theme_essential\toolbox::get_setting('pagetopblocks')) { + echo $OUTPUT->essential_blocks('page-top', 'row-fluid', 'aside', 'pagetopblocksperrow'); +} echo '
'; echo $OUTPUT->course_title(); echo $OUTPUT->course_content_header(); diff --git a/settings.php b/settings.php index 0f78b255..4c928758 100644 --- a/settings.php +++ b/settings.php @@ -97,6 +97,15 @@ $setting->set_updatedcallback('theme_reset_all_caches'); $essentialsettingsgeneric->add($setting); + // Toggle page top blocks. + $name = 'theme_essential/pagetopblocks'; + $title = get_string('pagetopblocks', 'theme_essential'); + $description = get_string('pagetopblocksdesc', 'theme_essential'); + $default = true; + $setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false); + $setting->set_updatedcallback('theme_reset_all_caches'); + $essentialsettingsgeneric->add($setting); + // Page top blocks per row. $name = 'theme_essential/pagetopblocksperrow'; $title = get_string('pagetopblocksperrow', 'theme_essential'); @@ -1625,6 +1634,17 @@ $setting->set_updatedcallback('theme_reset_all_caches'); $essentialsettingsfrontpage->add($setting); + // Page top blocks per row. + $name = 'theme_essential/fppagetopblocksperrow'; + $title = get_string('fppagetopblocksperrow', 'theme_essential'); + $default = 3; + $lower = 1; + $upper = 4; + $description = get_string('fppagetopblocksperrowdesc', 'theme_essential', + array('lower' => $lower, 'upper' => $upper)); + $setting = new essential_admin_setting_configinteger($name, $title, $description, $default, $lower, $upper); + $essentialsettingsfrontpage->add($setting); + // Marketing spot settings. $essentialsettingsfrontpage->add(new admin_setting_heading('theme_essential_marketing', get_string('marketingheading', 'theme_essential'),