public function LongAnswerResponse::score in Quiz 6.x
Same name and namespace in other branches
- 8.6 question_types/quiz_long_answer/src/Plugin/quiz/QuizQuestion/LongAnswerResponse.php \Drupal\quiz_long_answer\Plugin\quiz\QuizQuestion\LongAnswerResponse::score()
- 8.5 question_types/quiz_long_answer/src/Plugin/quiz/QuizQuestion/LongAnswerResponse.php \Drupal\quiz_long_answer\Plugin\quiz\QuizQuestion\LongAnswerResponse::score()
Calculate the unscaled score in points for this question response.
Parameters
array $values: A part of form state values with the question input from the user.
Return value
int|NULL The unscaled point value of the answer. If a point value is final, questions should make sure to run setEvaluated(). return NULL if the answer is not automatically scored.
Overrides QuizAnswerInterface::score
File
- question_types/
quiz_long_answer/ src/ Plugin/ quiz/ QuizQuestion/ LongAnswerResponse.php, line 17
Class
- LongAnswerResponse
- Extension of QuizQuestionResponse.
Namespace
Drupal\quiz_long_answer\Plugin\quiz\QuizQuestionCode
public function score(array $values) : ?int {
$this
->set('long_answer', $values['answer']);
$this
->setEvaluated(FALSE);
return NULL;
}