You are here

public function TrueFalseQuestion::getCreationForm in Quiz 6.6

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

Get the form used to create a new question.

Return value

Must return a FAPI array.

Overrides QuizQuestion::getCreationForm

File

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

Class

TrueFalseQuestion
Implementation of QuizQuestion.

Code

public function getCreationForm($edit) {
  $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,
  );
  $form['feedback_fields'] = array(
    '#type' => 'fieldset',
    '#title' => t('Feedback Settings'),
    '#description' => t('Settings pertaining to feedback given along with results.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['feedback_fields']['feedback'] = array(
    '#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;
}