Not able to understand certain methods from the moodle quiz module

Not able to understand certain methods from the moodle quiz module

by Mohanish Nagarkar -
Number of replies: 1

I am currently on moodle version 3.2.3+

I am working on the quiz module. I am not able to understand some of the methods in the mod/quiz/lib.php file. The methods are:

1. quiz_add_instance($quiz)
and

2. quiz_after_add_or_update($quiz)
The first method is not called anywhere so what is the need for it?

And in the second method, there's a feedback object getting generated. I am trying to use the method in my code but everytime I get 'mingrade value cannot be null'. I am not understanding the contents of the feedback object, mainly feedbacktext[$i][text], feedbackboundaries[$i] and feedbackboundarycount.

I am stuck as my quiz is not getting created so a quick help is what is needed


Thanks,

Mohanish

Average of ratings: -
In reply to Mohanish Nagarkar

Re: Not able to understand certain methods from the moodle quiz module

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You wont find a call to quiz_add_instance() specifically in the codebase, but it is being called.  It is a conventionally-named function that all activity module plugins define in lib.php so that Moodle knows where to find it.  You can read more about these functions in the example module documentation on the wiki: https://docs.moodle.org/dev/NEWMODULE_Documentation#lib.php