You are here

public function TrueFalseQuestion::getAnsweringForm in Quiz 6.4

Same name and namespace in other branches
  1. 7.6 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getAnsweringForm()
  2. 7 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getAnsweringForm()
  3. 7.4 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getAnsweringForm()
  4. 7.5 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getAnsweringForm()

Implementation of getAnsweringForm

Overrides QuizQuestion::getAnsweringForm

See also

QuizQuestion#getAnsweringForm($form_state, $rid)

File

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

Class

TrueFalseQuestion
Extension of QuizQuestion.

Code

public function getAnsweringForm(array $form_state = NULL, $rid) {
  $form = parent::getAnsweringForm($form_state, $rid);
  $form['#theme'] = 'truefalse_answering_form';

  // 'tries' is unfortunately required by quiz.module
  $form['tries'] = array(
    '#type' => 'radios',
    '#title' => t('Choose one'),
    '#options' => array(
      1 => t('True'),
      0 => t('False'),
    ),
  );
  if (isset($rid)) {
    $response = new TrueFalseResponse($rid, $this->node);
    $form['tries']['#default_value'] = $response
      ->getResponse();
  }
  return $form;
}