public function ScaleQuestion::getNodeView in Quiz 8.4
Implementation of getNodeView
Overrides QuizQuestion::getNodeView
See also
QuizQuestion#view()
File
- question_types/
scale/ lib/ Drupal/ scale/ ScaleQuestion.php, line 346 - The main classes for the short answer question type.
Class
- ScaleQuestion
- Extension of QuizQuestion.
Namespace
Drupal\scaleCode
public function getNodeView() {
$content = parent::getNodeView();
$alternatives = array();
for ($i = 0; $i < \Drupal::config('scale.settings')
->get('scale_max_num_of_alts'); $i++) {
if (isset($this->node->{$i}->answer) && drupal_strlen($this->node->{$i}->answer) > 0) {
$alternatives[] = check_plain($this->node->{$i}->answer);
}
}
$content['answer'] = array(
'#markup' => theme('scale_answer_node_view', array(
'alternatives' => $alternatives,
)),
'#weight' => 2,
);
return $content;
}