public function TrueFalseQuestion::getAnsweringForm in Quiz 7.4
Same name and namespace in other branches
- 6.4 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getAnsweringForm()
- 7.6 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getAnsweringForm()
- 7 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::getAnsweringForm()
- 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 124 - 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'),
),
'#default_value' => NULL,
);
if (isset($rid)) {
$response = new TrueFalseResponse($rid, $this->node);
$default = $response
->getResponse();
$form['tries']['#default_value'] = is_null($default) ? NULL : $default;
}
return $form;
}