You are here

public function TrueFalseQuestion::getNodeView in Quiz 6.4

Same name and namespace in other branches
  1. 7.6 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getNodeView()
  2. 7 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getNodeView()
  3. 7.4 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getNodeView()
  4. 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 91
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']['#type'] = 'markup';
    $content['answers']['#value'] = '<div class="quiz-solution">' . $answer . '</div>';
  }
  else {
    $content['answers'] = array(
      '#type' => 'markup',
      '#value' => '<div class="quiz-answer-hidden">Answer hidden</div>',
      '#weight' => 2,
    );
  }
  return $content;
}