From 822ba7d3d8f3cdb32b05c4a128a9b6b6076c8c5f Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 7 Aug 2014 14:20:06 +0100 Subject: [PATCH] MDL-46681 qtype_multichoice: disabled unused options For questions set to 'One answer only', the 'Clear incorrect responses' and 'Show the number of correct responses' hint options make not sense, and are not used. Hence we disableIf them. --- question/type/multichoice/edit_multichoice_form.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/question/type/multichoice/edit_multichoice_form.php b/question/type/multichoice/edit_multichoice_form.php index fa1f551d5a4..b0dc614b4b7 100644 --- a/question/type/multichoice/edit_multichoice_form.php +++ b/question/type/multichoice/edit_multichoice_form.php @@ -82,6 +82,13 @@ class qtype_multichoice_edit_form extends question_edit_form { return $repeated; } + protected function get_hint_fields($withclearwrong = false, $withshownumpartscorrect = false) { + list($repeated, $repeatedoptions) = parent::get_hint_fields($withclearwrong, $withshownumpartscorrect); + $repeatedoptions['hintclearwrong']['disabledif'] = array('single', 'eq', 1); + $repeatedoptions['hintshownumcorrect']['disabledif'] = array('single', 'eq', 1); + return array($repeated, $repeatedoptions); + } + protected function data_preprocessing($question) { $question = parent::data_preprocessing($question); $question = $this->data_preprocessing_answers($question, true);