You are here

public function MatchingQuestion::getCreationForm in Quiz 6.6

Same name and namespace in other branches
  1. 6.3 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
  2. 6.4 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
  3. 6.5 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
  4. 7.6 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
  5. 7 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
  6. 7.4 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
  7. 7.5 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()

Get the form used to create a new question.

Return value

Must return a FAPI array.

Overrides QuizQuestion::getCreationForm

File

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

Class

MatchingQuestion
Implementation of Matching.

Code

public function getCreationForm($edit) {
  $form['match'] = array(
    '#type' => 'fieldset',
    '#title' => t('Match Question'),
    '#tree' => TRUE,
  );
  for ($i = 1; $i <= variable_get('quiz_matching_form_size', 5); ++$i) {
    $form['match'][$i] = array(
      '#type' => 'fieldset',
      '#title' => t('Question ' . $i),
    );
    $form['match'][$i]['match_id'] = array(
      '#type' => 'hidden',
      '#default_value' => isset($this->node->answer[$i - 1]['match_id']) ? $this->node->answer[$i - 1]['match_id'] : '',
    );
    $form['match'][$i]['question'] = array(
      '#type' => 'textarea',
      '#title' => t('Question'),
      '#rows' => 2,
      '#default_value' => isset($this->node->answer[$i - 1]['question']) ? $this->node->answer[$i - 1]['question'] : '',
    );
    $form['match'][$i]['answer'] = array(
      '#type' => 'textarea',
      '#title' => t('Match'),
      '#rows' => 2,
      '#default_value' => isset($this->node->answer[$i - 1]['answer']) ? $this->node->answer[$i - 1]['answer'] : '',
    );
    $form['match'][$i]['feedback'] = array(
      '#type' => 'textarea',
      '#title' => t('Feedback / Reason'),
      '#rows' => 2,
      '#default_value' => isset($this->node->answer[$i - 1]['feedback']) ? $this->node->answer[$i - 1]['feedback'] : '',
    );
  }
  return $form;
}