public function MatchingQuestion::getCreationForm in Quiz 6.4
Same name and namespace in other branches
- 6.6 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
- 6.3 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
- 6.5 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
- 7.6 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
- 7 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
- 7.4 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
- 7.5 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
Implementation of getCreationForm
Overrides QuizQuestion::getCreationForm
See also
QuizQuestion#getCreationForm($form_state)
File
- question_types/
matching/ matching.classes.inc, line 259 - matching.classes
Class
- MatchingQuestion
- Extension of QuizQuestion.
Code
public function getCreationForm(array $form_state = NULL) {
$form['match'] = array(
'#type' => 'fieldset',
'#title' => t('Answer'),
'#weight' => -4,
'#tree' => TRUE,
'#theme' => 'matching_question_form',
'#description' => t('Write your pairs in the question and answer columns. For the user the question will be fixed and the answers will be shown as alternatives in a dropdown box.'),
);
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->match[$i - 1]['match_id']) ? $this->node->match[$i - 1]['match_id'] : '',
);
$form['match'][$i]['question'] = array(
'#type' => 'textarea',
'#rows' => 2,
'#default_value' => isset($this->node->match[$i - 1]['question']) ? $this->node->match[$i - 1]['question'] : '',
'#required' => $i < 3,
);
$form['match'][$i]['answer'] = array(
'#type' => 'textarea',
'#rows' => 2,
'#default_value' => isset($this->node->match[$i - 1]['answer']) ? $this->node->match[$i - 1]['answer'] : '',
'#required' => $i < 3,
);
$form['match'][$i]['feedback'] = array(
'#type' => 'textarea',
'#rows' => 2,
'#default_value' => isset($this->node->match[$i - 1]['feedback']) ? $this->node->match[$i - 1]['feedback'] : '',
);
}
return $form;
}