Browsed by
Tag: theme

Moodle Theming 4.1 : Login Background Image

Moodle Theming 4.1 : Login Background Image

Note : in order to work in addition to following the steps outlined here : https://docs.moodle.org/dev/Creating_a_theme_based_on_boost there needs to be an additional function added to the theme’s lib.php file otherwise the login background image and the body background image won’t load.

function theme_themename_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
    if ($context->contextlevel == CONTEXT_SYSTEM && ($filearea === 'logo' || $filearea === 'backgroundimage' || $filearea === 'loginbackgroundimage')) {
        $theme = theme_config::load('themename');
        // By default, theme files must be cache-able by both browsers and proxies.
        if (!array_key_exists('cacheability', $options)) {
            $options['cacheability'] = 'public';
        }
        return $theme->setting_file_serve($filearea, $args, $forcedownload, $options);
    } else {
        send_file_not_found();
    }
}