public function LongAnswerQuestion::getNodeView in Quiz 8.5
Same name and namespace in other branches
- 8.6 question_types/quiz_long_answer/src/Plugin/quiz/QuizQuestion/LongAnswerQuestion.php \Drupal\quiz_long_answer\Plugin\quiz\QuizQuestion\LongAnswerQuestion::getNodeView()
- 6.x question_types/quiz_long_answer/src/Plugin/quiz/QuizQuestion/LongAnswerQuestion.php \Drupal\quiz_long_answer\Plugin\quiz\QuizQuestion\LongAnswerQuestion::getNodeView()
Implementation of getNodeView().
Overrides QuizQuestionEntityTrait::getNodeView
See also
File
- question_types/
quiz_long_answer/ src/ Plugin/ quiz/ QuizQuestion/ LongAnswerQuestion.php, line 28
Class
- LongAnswerQuestion
- @QuizQuestion ( id = "long_answer", label = Plugin annotation @Translation("Long answer question"), handlers = { "response" = "\Drupal\quiz_long_answer\Plugin\quiz\QuizQuestion\LongAnswerResponse" } )
Namespace
Drupal\quiz_long_answer\Plugin\quiz\QuizQuestionCode
public function getNodeView() {
$content = parent::getNodeView();
if ($this
->viewCanRevealCorrect()) {
$content['answers'] = array(
'#type' => 'item',
'#title' => t('Rubric'),
'#markup' => '<div class="quiz-solution">' . check_markup($this->node->rubric['value'], $this->node->rubric['format']) . '</div>',
'#weight' => 1,
);
}
else {
$content['answers'] = array(
'#markup' => '<div class="quiz-answer-hidden">Answer hidden</div>',
'#weight' => 1,
);
}
return $content;
}