You are here

public function MultichoiceResponse::getResponse in Quiz 6.x

Same name and namespace in other branches
  1. 8.6 question_types/quiz_multichoice/src/Plugin/quiz/QuizQuestion/MultichoiceResponse.php \Drupal\quiz_multichoice\Plugin\quiz\QuizQuestion\MultichoiceResponse::getResponse()
  2. 8.5 question_types/quiz_multichoice/src/Plugin/quiz/QuizQuestion/MultichoiceResponse.php \Drupal\quiz_multichoice\Plugin\quiz\QuizQuestion\MultichoiceResponse::getResponse()

Get the user's response.

Return value

mixed The answer given by the user

Overrides QuizAnswerInterface::getResponse

1 call to MultichoiceResponse::getResponse()
MultichoiceResponse::getFeedbackValues in question_types/quiz_multichoice/src/Plugin/quiz/QuizQuestion/MultichoiceResponse.php

File

question_types/quiz_multichoice/src/Plugin/quiz/QuizQuestion/MultichoiceResponse.php, line 96

Class

MultichoiceResponse
Extension of QuizQuestionResponse.

Namespace

Drupal\quiz_multichoice\Plugin\quiz\QuizQuestion

Code

public function getResponse() {
  $vids = [];
  foreach ($this
    ->get('multichoice_answer')
    ->getValue() as $alternative) {
    $vids[] = $alternative['value'];
  }
  return $vids;
}