Skip to content

Commit

Permalink
#370 - Improvement: Don't force child theme to reimplement activitypu…
Browse files Browse the repository at this point in the history
…rpose_MODNAME settings
  • Loading branch information
danowar2k committed Aug 24, 2023
1 parent f5d5932 commit f9629be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changes

### Unreleased

* 2023-08-24 - Improvement: Don't force child theme to reimplement activitypurpose_MODNAME settings, solves #370.
* 2023-08-19 - Improvement: Fix more mustache linter warnings, solves #360.
* 2023-08-02 - Improvement: Add 'aboutus', 'offers', 'page1', 'page2' and 'page3' static pages, solves #351.
* 2023-08-19 - Bugfix: Fix unparsable example JSON in Mustache template, solves #348.
Expand Down
10 changes: 5 additions & 5 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,17 +312,17 @@ function theme_boost_union_get_extra_scss($theme) {
$defaultpurpose = MOD_PURPOSE_OTHER;
}
// If the activity purpose setting is set and differs from the activity's default purpose.
$configname = 'activitypurpose'.$modname;
if (isset($theme->settings->{$configname}) && $theme->settings->{$configname} != $defaultpurpose) {
$activitypurpose = get_config('theme_boost_union', 'activitypurpose'.$modname);
if ($activitypurpose && $activitypurpose != $defaultpurpose) {
// Add CSS to modify the activity purpose color in the activity chooser and the activity icon.
$content .= '.activity.modtype_'.$modname.' .activityiconcontainer.courseicon,';
$content .= '.modchoosercontainer .modicon_'.$modname.'.activityiconcontainer,';
$content .= '#page-header .modicon_'.$modname.'.activityiconcontainer,';
$content .= '.block_recentlyaccesseditems .theme-boost-union-'.$modname.'.activityiconcontainer,';
$content .= '.block_timeline .theme-boost-union-mod_'.$modname.'.activityiconcontainer {';
// If the purpose is now different than 'other', change the background color to the new color.
if ($theme->settings->{$configname} != MOD_PURPOSE_OTHER) {
$content .= 'background-color: var(--activity' . $theme->settings->{$configname} . ') !important;';
if ($activitypurpose != MOD_PURPOSE_OTHER) {
$content .= 'background-color: var(--activity'.$activitypurpose.') !important;';

// Otherwise, the background color is set to light grey (as there is no '--activityother' variable).
} else {
Expand All @@ -333,7 +333,7 @@ function theme_boost_union_get_extra_scss($theme) {
$content .= '.activityicon, .icon { filter: brightness(0) invert(1); }';
}
// If the default purpose was not 'other' and now it is, make the icon black.
if ($theme->settings->{$configname} == MOD_PURPOSE_OTHER) {
if ($activitypurpose == MOD_PURPOSE_OTHER) {
$content .= '.activityicon, .icon { filter: none; }';
}
$content .= '}';
Expand Down

0 comments on commit f9629be

Please sign in to comment.