BIM2 and disable_form_change_checker

As a developer, you have to love it when someone using your code diagnoses and identifies their own problem with your code. Especially if they give you a clear and concise explanation you can use. That’s what happened with the BIM2 problem I blogged about recently. It appears I was using Moodle 2.3.4 the problem was found on Moodle 2.3.2+ and there was a change in the Moodle code in-between. The following describes the bug and hopefully the fix/change I’ve made to the BIM code.

The problem

The problem arises in bim/marker/allocation_form.php with this

       // turn off the checking

disable_form_change_checker is described here and it was added in Moodle 2.3.3.

So the question is how to handle this neatly so that BIM gracefully degrades with older versions of Moodle?

The solution?

One approach is to simply require the more recent version of Moodle, but given this is one function call in one section of the code. There has to be a more fine grain solution, doesn’t there?

Perhaps just removing the call? But I remember it getting quite annoying without it. So, for now, it stays.

Of course, method_exists. I need to code more.

        if ( method_exists( $mform, "disable_form_change_checker" ) ) {

No problem with 2.4. What about older versions?

Yes, Moodle 2.2 crashes with this problem in BIM. And method_exists fixes it. Time to commit the code and we’re done.

One thought on “BIM2 and disable_form_change_checker

  1. Pingback: Adding bim 2.0 to “CONTRIB” | The Weblog of (a) David Jones

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s