public function ShortAnswerQuestion::getAnsweringForm in Quiz 7.6
Same name and namespace in other branches
- 6.4 question_types/short_answer/short_answer.classes.inc \ShortAnswerQuestion::getAnsweringForm()
- 7 question_types/short_answer/short_answer.classes.inc \ShortAnswerQuestion::getAnsweringForm()
- 7.4 question_types/short_answer/short_answer.classes.inc \ShortAnswerQuestion::getAnsweringForm()
- 7.5 question_types/short_answer/short_answer.classes.inc \ShortAnswerQuestion::getAnsweringForm()
Implementation of getAnsweringForm
Overrides QuizQuestion::getAnsweringForm
See also
QuizQuestion#getAnsweringForm($form_state, $result_id)
File
- question_types/
short_answer/ short_answer.classes.inc, line 135 - The main classes for the short answer question type.
Class
- ShortAnswerQuestion
- Extension of QuizQuestion.
Code
public function getAnsweringForm(array $form_state = NULL, $result_id) {
$form = parent::getAnsweringForm($form_state, $result_id);
//$form['#theme'] = 'short_answer_answering_form';
$form = array(
'#type' => 'textfield',
'#title' => t('Answer'),
'#description' => t('Enter your answer here'),
'#default_value' => '',
'#size' => 60,
'#maxlength' => 256,
'#required' => FALSE,
'#attributes' => array(
'autocomplete' => 'off',
),
);
if (isset($result_id)) {
$response = new ShortAnswerResponse($result_id, $this->node);
$form['#default_value'] = $response
->getResponse();
}
return $form;
}