moodle-an-hochschulen / moodle-theme_boost_union_child

Boost Union Child is a boilerplate for enhancing Boost Union with custom or local functionality
GNU General Public License v3.0
4 stars 2 forks source link

Use file chooser image for courseheaderimagefallback in child theme #1

Closed dbnschools closed 9 months ago

dbnschools commented 9 months ago

Is it possible to use the Boost Union image courseheaderimagefallback in the child theme where it would generate a proper URL to the image in core_renderer.php such as with this code: $headerbg = $this->page->theme->setting_file_url('courseheaderimagefallback', 'courseheaderimagefallback');

Currently I can get the proper image name but it cannot generate the proper URL to the image from the child theme.

`public function get_generated_image_for_id($id) {

    $headerbg = $this->page->theme->setting_file_url('courseheaderimagefallback', 'courseheaderimagefallback');

    $hasheaderbg = get_config('theme_boost_union', 'courseheaderimageenabled')
    == THEME_BOOST_UNION_SETTING_SELECT_YES;
    if (isset($headerbg) && $hasheaderbg)  {
        return $headerbg;
    } elseif ($hasheaderbg) {
        // Usefallback image for mycourse regardless.
        return $this->page->theme->image_url('noimg', 'theme')->out();
    } else {
        $color = $this->get_generated_color_for_id($id);
        $pattern = new \core_geopattern();
        $pattern->setColor($color);
        $pattern->patternbyid($id);
        return $pattern->datauri();
    }
}`

As I am developing a child theme I would like to use as many of the core Boost Union settings as possible to avoid confusion and also to keep as many of the theme settings in Boost Union in case they remove my child theme.

dbnschools commented 9 months ago

closed. Resolved.