You are here

public function TrueFalseQuestion::getCreationForm in Quiz 7.4

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

Implementation of getCreationForm

Overrides QuizQuestion::getCreationForm

See also

QuizQuestion#getCreationForm($form_state)

File

question_types/truefalse/truefalse.classes.inc, line 161
Defines the classes necessary for a True/False quiz.

Class

TrueFalseQuestion
Extension of QuizQuestion.

Code

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;
}