public function ShortAnswerQuestion::getNodeView in Quiz 7.6
Same name and namespace in other branches
- 6.4 question_types/short_answer/short_answer.classes.inc \ShortAnswerQuestion::getNodeView()
- 7 question_types/short_answer/short_answer.classes.inc \ShortAnswerQuestion::getNodeView()
- 7.4 question_types/short_answer/short_answer.classes.inc \ShortAnswerQuestion::getNodeView()
- 7.5 question_types/short_answer/short_answer.classes.inc \ShortAnswerQuestion::getNodeView()
Implementation of getNodeView
Overrides QuizQuestion::getNodeView
See also
QuizQuestion#getNodeView()
File
- question_types/
short_answer/ short_answer.classes.inc, line 113 - The main classes for the short answer question type.
Class
- ShortAnswerQuestion
- Extension of QuizQuestion.
Code
public function getNodeView() {
$content = parent::getNodeView();
if ($this
->viewCanRevealCorrect()) {
$content['answers'] = array(
'#markup' => '<div class="quiz-solution">' . check_plain($this->node->correct_answer) . '</div>',
'#weight' => 2,
);
}
else {
$content['answers'] = array(
'#markup' => '<div class="quiz-answer-hidden">Answer hidden</div>',
'#weight' => 2,
);
}
return $content;
}