Fordson and Moodle 3.7 Beta

Fordson and Moodle 3.7 Beta

by Chris Kenniburg -
Number of replies: 5
Picture of Particularly helpful Moodlers Picture of Plugin developers

If you are looking to upgrade to Moodle 3.7 the minute it is released, I have a beta release of the Fordson theme that should be compatible with Moodle 3.7 as of today.  

As we begin to shift away from Moodle 3.6 and look to 3.7, so too will our development.  

Please download and try this out.  I am just trying to do initial bug fixes to make sure everything works without issues.


https://drive.google.com/drive/folders/1bjEtXZjsjPRHi8XSAB4kgSPmbHjrbJk8?usp=sharing


Thanks,

Chris

Average of ratings: Useful (2)
In reply to Chris Kenniburg

Re: Fordson and Moodle 3.7 Beta

by Chris Kenniburg -
Picture of Particularly helpful Moodlers Picture of Plugin developers

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

Average of ratings: Useful (1)
In reply to Chris Kenniburg

Re: Fordson and Moodle 3.7 Beta

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Interesting Chris, but the code looks inefficient, so:

    public function get_generated_image_for_id($id) {
        // See if user uploaded a custom header background to the theme.
        $headerbg = $this->page->theme->setting_file_url('headerdefaultimage', 'headerdefaultimage');
        if (isset($headerbg)) {
            return $headerbg;
        } else {
            // Use the default theme image when no course image is detected.
            return $this->image_url('noimg', 'theme')->out();
        }
    }

should be better.

Average of ratings: Useful (2)
In reply to Chris Kenniburg

Re: Re: Fordson and Moodle 3.7 Beta

by Acqua Alta -
Hi Chris,
Thank you for your wonderful theme.

Just want to know - You wrote "We have a Moodle 3.7 version in the works that will eliminate the javascript and instead use a proper renderer". Did it come to conclusion in the version that you released on May 21th?
Version Moodle 3.7 Fordson v3.7 release 1 (2019111006)