You are here

public function LongAnswerQuestion::getNodeView in Quiz 8.4

Implementation of getNodeView

Overrides QuizQuestion::getNodeView

See also

QuizQuestion#getNodeView()

File

question_types/long_answer/lib/Drupal/long_answer/LongAnswerQuestion.php, line 114
Long answer classes.

Class

LongAnswerQuestion
Extension of QuizQuestion.

Namespace

Drupal\long_answer

Code

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, $this
        ->getFormat()) . '</div>',
      '#weight' => 1,
    );
  }
  else {
    $content['answers'] = array(
      '#markup' => '<div class="quiz-answer-hidden">Answer hidden</div>',
      '#weight' => 1,
    );
  }
  return $content;
}