public function MatchingQuestion::getCorrectAnswer in Quiz 8.4
Get the correct answers for this question
Return value
Array of correct answers
File
- question_types/
matching/ lib/ Drupal/ matching/ MatchingQuestion.php, line 367 - The main classes for the matching question type.
Class
- MatchingQuestion
- Extension of QuizQuestion.
Namespace
Drupal\matchingCode
public function getCorrectAnswer() {
$correct_answers = array();
$query = db_query('SELECT match_id, question, answer, feedback FROM {quiz_matching_node} WHERE nid = :nid AND vid = :vid', array(
':nid' => $this->node
->id(),
':vid' => $this->node
->getRevisionId(),
));
while ($result = $query
->fetch()) {
$correct_answers[$result->match_id] = array(
'match_id' => $result->match_id,
'question' => $result->question,
'answer' => $result->answer,
'feedback' => $result->feedback,
);
}
return $correct_answers;
}