Skip to content
Snippets Groups Projects
Commit 2dcc3660 authored by Kathrin Osswald's avatar Kathrin Osswald
Browse files

Setting to be able to display the title for the first course section (section 0) again.

parent d7743748
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ Changes
### Unreleased
* 2017-03-10 - Setting to be able to display the title for the first course section (section 0) again.
* 2017-03-09 - Placed course edit on / off button in the course header again like it was displayed before theme_boost.
* 2017-03-08 - Course settings icon will now be displayed on all sites that display the course header.
* 2017-03-06 - Changed flat navigation nav-drawer menu code to make all items structured uniformly and improve the layout of the menu.
......
......@@ -63,6 +63,10 @@ This setting is already available in the Moodle core theme Boost. For more infor
With this setting you can add block regions to the footer to be able to place blocks within the footer. You can choose between no blocks (default value) or one up to three block columns in the footer. The two and three columns layouts are only displayed on large screens. On small screens the columns will be automatically reduced to one column for better readability and layout.
#### Section 0: Title
This setting can change the behaviour Moodle displays the title for the first course section. Moodle does not display it as long as the default title for this section is set. As soon as a user changes the title, it will appear. With this setting (option is checked), you can achieve a consistent behaviour by always showing the title for section 0.
Further improvements to Boost core theme
----------------------------------------
......
......@@ -146,6 +146,7 @@ $THEME->layouts = [
];
$THEME->enable_dock = false;
$THEME->prescsscallback = 'theme_boost_campus_get_pre_scss';
$THEME->yuicssmodules = array();
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
$THEME->requiredblocks = ' ';
......
......@@ -43,3 +43,6 @@ $string['region-footer-left'] = 'Footer (left)';
$string['region-footer-middle'] = 'Footer (middle)';
$string['region-footer-right'] = 'Footer (right)';
$string['region-side-pre'] = 'Right';
$string['section0titlesetting'] = 'Section 0: Title';
$string['section0titlesetting_desc'] = 'This setting can change the behaviour Moodle displays the title for the first course section. Moodle does not display it as long as the default title for this section is set. As soon as a user changes the title, it will appear. With this setting (option is checked), you can achieve a consistent behaviour by always showing the title for section 0.';
......@@ -55,3 +55,42 @@ function theme_boost_campus_get_main_scss_content($theme) {
// Combine them together.
return $pre . "\n" . $scss . "\n" . $post;
}
/**
* Override to add CSS values from settings to pre scss file.
*
* Get SCSS to prepend.
*
* @param theme_config $theme The theme config object.
* @return array
*/
function theme_boost_campus_get_pre_scss($theme) {
global $CFG;
$scss = '';
$configurable = [
// Config key => [variableName, ...].
'brandcolor' => ['brand-primary'],
/* MODIFICATION START */
'section0title' => ['section0title'],
/* MODIFICATION END */
];
// Prepend variables first.
foreach ($configurable as $configkey => $targets) {
$value = isset($theme->settings->{$configkey}) ? $theme->settings->{$configkey} : null;
if (empty($value)) {
continue;
}
array_map(function($target) use (&$scss, $value) {
$scss .= '$' . $target . ': ' . $value . ";\n";
}, (array) $targets);
}
// Prepend pre-scss.
if (!empty($theme->settings->scsspre)) {
$scss .= $theme->settings->scsspre;
}
return $scss;
}
......@@ -135,3 +135,22 @@
vertical-align: sub;
}
}
/*------------------------------------
Course content
-------------------------------------*/
/*
* Sections
*/
/* Check if setting theme_boost_campus|section0title is set.
If set, then revert the styles from .accesshide and set the style to be the same as other section titles. */
body.path-course-view #section-0 h3.accesshide {
@if $section0title == 'yes' {
position: inherit;
left: inherit;
font-weight: $headings-font-weight;
font-size: $font-size-h3;
}
}
......@@ -119,6 +119,15 @@ if ($ADMIN->fulltree) {
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);
// Setting for displaying section-0 title in courses
$setting = new admin_setting_configcheckbox('theme_boost_campus/section0title',
get_string('section0titlesetting', 'theme_boost_campus', null, true),
get_string('section0titlesetting_desc', 'theme_boost_campus', null, true), 'no', 'yes', 'no'); // Overriding default values
// yes = 1 and no = 0 because of the use of empty() in theme_boost_campus_get_pre_scss() (lib.php). Default 0 value would
// not write the variable to scss that could cause the scss to crash if used in that file.
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);
// Add tab to settings page.
$settings->add($page);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment