You are here

public function TrueFalseQuestion::getCorrectAnswer in Quiz 8.5

Same name and namespace in other branches
  1. 8.6 question_types/quiz_truefalse/src/Plugin/quiz/QuizQuestion/TrueFalseQuestion.php \Drupal\quiz_truefalse\Plugin\quiz\QuizQuestion\TrueFalseQuestion::getCorrectAnswer()
  2. 6.x question_types/quiz_truefalse/src/Plugin/quiz/QuizQuestion/TrueFalseQuestion.php \Drupal\quiz_truefalse\Plugin\quiz\QuizQuestion\TrueFalseQuestion::getCorrectAnswer()

Get the correct answer to this question.

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

Return value

bool Boolean indicating if the correct answer is TRUE or FALSE

File

question_types/quiz_truefalse/src/Plugin/quiz/QuizQuestion/TrueFalseQuestion.php, line 109

Class

TrueFalseQuestion
@QuizQuestion ( id = "truefalse", label = Plugin annotation @Translation("True/false question"), handlers = { "response" = "\Drupal\quiz_truefalse\Plugin\quiz\QuizQuestion\TrueFalseResponse" } )

Namespace

Drupal\quiz_truefalse\Plugin\quiz\QuizQuestion

Code

public function getCorrectAnswer() {
  return $this
    ->get('truefalse_correct')
    ->getString();
}