You are here

public function TrueFalseQuestion::getCorrectAnswer in Quiz 8.4

Get the answer to this question.

This is a utility function. It is not defined in the interface.

File

question_types/truefalse/lib/Drupal/truefalse/TrueFalseQuestion.php, line 227
Defines the classes necessary for a True/False quiz.

Class

TrueFalseQuestion
Extension of QuizQuestion.

Namespace

Drupal\truefalse

Code

public function getCorrectAnswer() {
  return db_query('SELECT correct_answer FROM {quiz_truefalse_node} WHERE nid = :nid AND vid = :vid', array(
    ':nid' => $this->node
      ->id(),
    ':vid' => $this->node
      ->getRevisionId(),
  ))
    ->fetchField();
}