You are here

public function TrueFalseQuestion::getNodeView in Quiz 7.5

Same name and namespace in other branches
  1. 6.4 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getNodeView()
  2. 7.6 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getNodeView()
  3. 7 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getNodeView()
  4. 7.4 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 85
TrueFalse classes.

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;
}