Skip to content

Commit

Permalink
#155 Cleanup no longer used files and functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
mwehr committed Jul 19, 2023
1 parent 94a3eab commit c661d67
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 120 deletions.
90 changes: 0 additions & 90 deletions flavours/styles.php

This file was deleted.

19 changes: 15 additions & 4 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,20 @@ function theme_boost_union_get_pre_scss($theme) {
if ($rawscsspre !== false) {
$scss .= "\n/** RAW-SCSS from theme_boost_union_get_pre_scss **/\n" . $rawscsspre;
}

// If the flavour has a background image.
$backgroundimage = theme_boost_union_get_flavour_config_item_for_id($flavourid, 'look_backgroundimage');
if ($backgroundimage != false) {
// Compose the URL to the flavour's background image.
$backgroundimageurl = moodle_url::make_pluginfile_url(
context_system::instance()->id, 'theme_boost_union', 'flavours_look_backgroundimage', $flavourid,
'/'.theme_get_revision(), '/'.$backgroundimage);

// And add it to the SCSS code, adhering the fact that we must not overwrite the login page background image again.
$scss .= 'body:not(.pagelayout-login) { ';
$scss .= 'background-image: url("'.$backgroundimageurl.'");';
$scss .= '}';
}
}
// Since setting "precss" is originally from parent boost it is added in theme_boost_get_pre_scss.
return $scss;
Expand Down Expand Up @@ -308,7 +322,7 @@ function theme_boost_union_get_extra_scss($theme) {
// Note: Boost Union is also capable of overriding the background image in its flavours.
// In contrast to the other flavour assets like the favicon overriding, this isn't done here in place as this function
// is composing Moodle core CSS which has to remain flavour-independent.
// Instead, the flavour is overriding the background image later in flavours/styles.php.
// Instead, the flavour is overriding the background image later in theme_boost_union_get_pre_scss() lib.php.

// For the rest of this function, we add SCSS snippets to the SCSS stack based on enabled admin settings.
// This is done here as it is quite easy to do. As an alternative, it could also been done in post.css by using
Expand Down Expand Up @@ -527,9 +541,6 @@ function theme_boost_union_before_standard_html_head() {
// Add the FontAwesome icons to the page.
theme_boost_union_add_fontawesome_to_page();

// Add the flavour CSS to the page.
theme_boost_union_add_flavourcss_to_page(); // Todo remove em when flavour pre/post scss goes prod.

// Return an empty string to keep the caller happy.
return $html;
}
Expand Down
26 changes: 0 additions & 26 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1215,32 +1215,6 @@ function theme_boost_union_add_fontawesome_to_page() {
}
}

/**
* Helper function which adds the CSS file from the flavour to the Moodle page.
* It's meant to be called by theme_boost_union_before_standard_html_head() only.
* *
* @throws coding_exception
* @throws dml_exception
* @throws moodle_exception
*/
function theme_boost_union_add_flavourcss_to_page() {
global $CFG, $PAGE;

// Require flavours library.
require_once($CFG->dirroot . '/theme/boost_union/flavours/flavourslib.php');

// If any flavour applies to this page.
$flavour = theme_boost_union_get_flavour_which_applies();
if ($flavour != null) {
// Build the flavour CSS file URL.
$flavourcssurl = new moodle_url('/theme/boost_union/flavours/styles.php',
array('id' => $flavour->id, 'rev' => theme_get_revision()));

// Add the CSS file to the page.
$PAGE->requires->css($flavourcssurl);
}
}

/**
* Helper function which returns the course header image url, picking the current course from the course settings
* or the fallback image from the theme.
Expand Down

0 comments on commit c661d67

Please sign in to comment.