You are here

public function QuizResultAnswerEntityTrait::getReportFormScore in Quiz 8.5

Same name and namespace in other branches
  1. 8.6 src/Entity/QuizResultAnswerEntityTrait.php \Drupal\quiz\Entity\QuizResultAnswerEntityTrait::getReportFormScore()
  2. 6.x src/Entity/QuizResultAnswerEntityTrait.php \Drupal\quiz\Entity\QuizResultAnswerEntityTrait::getReportFormScore()

Implementation of getReportFormScore().

See also

QuizQuestionResponse::getReportFormScore()

1 call to QuizResultAnswerEntityTrait::getReportFormScore()
QuizResultAnswerEntityTrait::getReportForm in src/Entity/QuizResultAnswerEntityTrait.php
Creates the report form for the admin pages.

File

src/Entity/QuizResultAnswerEntityTrait.php, line 237

Class

QuizResultAnswerEntityTrait
Each question type must store its own response data and be able to calculate a score for that data.

Namespace

Drupal\quiz\Entity

Code

public function getReportFormScore() {
  $score = $this
    ->isEvaluated() ? $this
    ->getPoints() : '';
  return array(
    '#title' => 'Enter score',
    '#type' => 'number',
    '#default_value' => $score,
    '#min' => 0,
    '#max' => $this
      ->getMaxScore(),
    '#attributes' => array(
      'class' => array(
        'quiz-report-score',
      ),
    ),
    '#required' => TRUE,
    '#field_suffix' => '/ ' . $this
      ->getMaxScore(),
  );
}