public function TrueFalseQuestion::getNodeView in Quiz 7.4
Same name and namespace in other branches
- 6.4 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getNodeView()
- 7.6 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getNodeView()
- 7 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getNodeView()
- 7.5 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getNodeView()
Implementation of getNodeView
Overrides QuizQuestion::getNodeView
See also
QuizQuestion#getNodeView()
File
- question_types/
truefalse/ truefalse.classes.inc, line 103 - Defines the classes necessary for a True/False quiz.
Class
- TrueFalseQuestion
- Extension of QuizQuestion.
Code
public function getNodeView() {
$content = parent::getNodeView();
if ($this
->viewCanRevealCorrect()) {
$answer = $this->node->correct_answer ? t('True') : t('False');
$content['answers']['#markup'] = '<div class="quiz-solution">' . $answer . '</div>';
$content['answers']['#weight'] = 2;
}
else {
$content['answers'] = array(
'#markup' => '<div class="quiz-answer-hidden">' . t('Answer hidden') . '</div>',
'#weight' => 2,
);
}
return $content;
}