Just an update on the Dashboard:
Bas has helped slip in a small fix with HUGE benefits for themes in that we no longer have to use Javascript to hack a renderer for the Dashboard display of courses with no images. Previously Moodle would generate a colored pattern for any course without an image in the course files. Fordson fixed this by using Javascript to put a sitewide default image in place of the geometric shape. This worked but was far from ideal.
Moodle 3.7 moved the shape generator to a place where themes can override that. Well, Fordson is ready to go! We have a Moodle 3.7 version in the works that will eliminate the javascript and instead use a proper renderer.
Many thanks to the Moodle team for getting this included! Makes a big difference for theme designers.
To help others, here is our override that we put into core_renderer:
public function get_generated_image_for_id($id) {
global $OUTPUT, $PAGE;
//see if user uploaded a custom header background to the theme
$headerbg = $PAGE->theme->setting_file_url('headerdefaultimage', 'headerdefaultimage');
//use the default theme image when no course image is detected
$defaultimgurl = $OUTPUT->image_url('noimg', 'theme')->out();
if (isset($headerbg)) {
return $headerbg;
} else {
return $defaultimgurl;
}
}
This will simply check to see if there is a header image uploaded into the Custom Image tab of Fordson theme. If yes, it uses that. If no, it uses the default course image that comes packaged with the theme.
At no point will you see the geometric shape when using Fordson!
Thanks Bas!
Chris