diff --git a/question_types/matching/matching.classes.inc b/question_types/matching/matching.classes.inc old mode 100644 new mode 100755 index 99eb831..16078af --- a/question_types/matching/matching.classes.inc +++ b/question_types/matching/matching.classes.inc @@ -208,6 +208,7 @@ class MatchingQuestion extends QuizQuestion { $form['subquestions'][$match['match_id']]['tries[' . $match['match_id'] . ']']['#default_value'] = $responses[$match['match_id']]; } } + $this->remove_repeated($form['subquestions']); $form['scoring_info'] = array( '#markup' => '

' . t('You lose points by selecting incorrect options. You may leave an option blank to avoid losing points.') . '

', ); @@ -217,6 +218,15 @@ class MatchingQuestion extends QuizQuestion { return $form; } + private function remove_repeated(&$form) + { + foreach($form as $index => &$question) + { + if (isset($question['tries[' . $index . ']']['#options'])){ + $question['tries[' . $index . ']']['#options']=array_unique($question['tries[' . $index . ']']['#options']);} + } + } + /** * Shuffles an array, but keeps the keys, and makes sure the first element is the default element *