You are here

public function QuizQuestionEntityTrait::getAnsweringForm in Quiz 8.6

Same name and namespace in other branches
  1. 8.5 src/Entity/QuizQuestionEntityTrait.php \Drupal\quiz\Entity\QuizQuestionEntityTrait::getAnsweringForm()
  2. 6.x src/Entity/QuizQuestionEntityTrait.php \Drupal\quiz\Entity\QuizQuestionEntityTrait::getAnsweringForm()

Get the form through which the user will answer the question.

Question types should populate the form with selected values from the current result if possible.

Parameters

FormStateInterface $form_state: Form state.

QuizResultAnswer $quizQuestionResultAnswer: The quiz result answer.

Return value

array Form array.

6 calls to QuizQuestionEntityTrait::getAnsweringForm()
LongAnswerQuestion::getAnsweringForm in question_types/quiz_long_answer/src/Plugin/quiz/QuizQuestion/LongAnswerQuestion.php
Get the form through which the user will answer the question.
MatchingQuestion::getAnsweringForm in question_types/quiz_matching/src/Plugin/quiz/QuizQuestion/MatchingQuestion.php
Implementation of getAnsweringForm().
MultichoiceQuestion::getAnsweringForm in question_types/quiz_multichoice/src/Plugin/quiz/QuizQuestion/MultichoiceQuestion.php
Get the form through which the user will answer the question.
QuizDirectionsQuestion::getAnsweringForm in question_types/quiz_directions/src/Plugin/quiz/QuizQuestion/QuizDirectionsQuestion.php
Get the form through which the user will answer the question.
ShortAnswerQuestion::getAnsweringForm in question_types/quiz_short_answer/src/Plugin/quiz/QuizQuestion/ShortAnswerQuestion.php
Get the form through which the user will answer the question.

... See full list

7 methods override QuizQuestionEntityTrait::getAnsweringForm()
LongAnswerQuestion::getAnsweringForm in question_types/quiz_long_answer/src/Plugin/quiz/QuizQuestion/LongAnswerQuestion.php
Get the form through which the user will answer the question.
MatchingQuestion::getAnsweringForm in question_types/quiz_matching/src/Plugin/quiz/QuizQuestion/MatchingQuestion.php
Implementation of getAnsweringForm().
MultichoiceQuestion::getAnsweringForm in question_types/quiz_multichoice/src/Plugin/quiz/QuizQuestion/MultichoiceQuestion.php
Get the form through which the user will answer the question.
QuizDirectionsQuestion::getAnsweringForm in question_types/quiz_directions/src/Plugin/quiz/QuizQuestion/QuizDirectionsQuestion.php
Get the form through which the user will answer the question.
QuizPageQuestion::getAnsweringForm in question_types/quiz_page/src/Plugin/quiz/QuizQuestion/QuizPageQuestion.php
Implementation of getAnsweringForm().

... See full list

File

src/Entity/QuizQuestionEntityTrait.php, line 148

Class

QuizQuestionEntityTrait
A trait all Quiz question strongly typed entity bundles must use.

Namespace

Drupal\quiz\Entity

Code

public function getAnsweringForm(FormStateInterface $form_state, QuizResultAnswer $quizQuestionResultAnswer) {
  $form = array();
  $form['#element_validate'] = [
    [
      static::class,
      'getAnsweringFormValidate',
    ],
  ];
  return $form;
}