You are here

public function MatchingQuestion::getQuestionForm in Quiz 6.6

Same name and namespace in other branches
  1. 6.3 question_types/matching/matching.classes.inc \MatchingQuestion::getQuestionForm()
  2. 6.5 question_types/matching/matching.classes.inc \MatchingQuestion::getQuestionForm()

Get the form that will be displayed to the test-taking user.

Parameters

$node: The question node.

$context: The form context.

Return value

Must return a FAPI array.

Overrides QuizQuestion::getQuestionForm

1 call to MatchingQuestion::getQuestionForm()
MatchingQuestion::view in question_types/matching/matching.classes.inc
Retrieve information relevant for viewing the node. This data is generally added to the node's extra field.

File

question_types/matching/matching.classes.inc, line 88
matching.classes

Class

MatchingQuestion
Implementation of Matching.

Code

public function getQuestionForm($node, $context = NULL) {
  list($questions, $select_option) = $this
    ->getQuestion($node);
  foreach ($questions as $question) {
    $title = $question['question'];
    if (!_quiz_is_taking_context()) {
      $title .= " (answer is '{$question['answer']}')";
    }
    $form['tries[' . $question['match_id'] . ']'] = array(
      '#type' => 'select',
      '#title' => $title,
      '#options' => $this
        ->customShuffle($select_option),
    );
  }
  return variable_get('quiz_matching_shuffle_options', TRUE) ? $this
    ->customShuffle($form) : $form;
}