Closed brissone closed 5 years ago
There ought to be a better option for achieving this, where you still use the parent class functionality, but then afterwards remove the unwanted "question test is required" rule. However, I am not sure of the details off the top of my head, and I don't want to think about it now.
Well, I did think about it anyway. There does not seem to be a nice way to do it, but
unset($mform->_rules['questiontext']);
inside definition_inner, after deleting the copy of definition, should work. I think.
Hi Tim,
Thank you so much for your note - it prompted me to look into this again, and I was able to make it work with the following in definition_inner:
unset($mform->_rules['questiontext']);
$mform->_required = array_diff($mform->_required,array('questiontext'));
The second line removed the red exclamation mark icon besides the Question Text field.
I tested and published a new version on Moodle.org. I figure (and hope) that the pear library won't change very often, which would make the plugin easier to upgrade to future Moodle versions. Maybe a future version of pear will include removeRule() at some point...
Thanks again! Eric
Doing so will leave the decision as to whether the question text is required to Moodle rather than to the plugin. It will facilitate upgrades to later Moodle versions, but will require the additional of a question field asking whether one want to use the automated question text.