public function TrueFalseQuestion::getCreationForm in Quiz 8.4
Implementation of getCreationForm
Overrides QuizQuestion::getCreationForm
See also
QuizQuestion#getCreationForm($form_state)
File
- question_types/
truefalse/ lib/ Drupal/ truefalse/ TrueFalseQuestion.php, line 179 - Defines the classes necessary for a True/False quiz.
Class
- TrueFalseQuestion
- Extension of QuizQuestion.
Namespace
Drupal\truefalseCode
public function getCreationForm(array &$form_state = NULL) {
$form['correct_answer'] = array(
'#type' => 'radios',
'#title' => t('Correct answer'),
'#options' => array(
1 => t('True'),
0 => t('False'),
),
'#default_value' => isset($this->node->correct_answer) ? $this->node->correct_answer : 1,
'#required' => TRUE,
'#weight' => -4,
'#description' => t('Choose if the correct answer for this question is "true" or "false".'),
);
$form['feedback_fields'] = array(
'#type' => 'fieldset',
'#title' => t('Feedback Settings'),
'#description' => t('Settings pertaining to feedback given along with results.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => -3,
);
$form['feedback_fields']['feedback'] = array(
// @todo: Does this make sense?
'#type' => 'textarea',
'#title' => t('Feedback Text'),
'#description' => t('Text to be displayed when the results are displayed'),
'#rows' => 5,
'#cols' => 60,
'#required' => FALSE,
'#default_value' => isset($this->node->feedback) ? $this->node->feedback : '',
);
return $form;
}