You are here

public function ShortAnswerQuestion::getAnsweringForm in Quiz 6.4

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

Implementation of getAnsweringForm

Overrides QuizQuestion::getAnsweringForm

See also

QuizQuestion#getAnsweringForm($form_state, $rid)

File

question_types/short_answer/short_answer.classes.inc, line 128
The main classes for the short answer question type.

Class

ShortAnswerQuestion
Extension of QuizQuestion.

Code

public function getAnsweringForm(array $form_state = NULL, $rid) {
  $form = parent::getAnsweringForm($form_state, $rid);
  $form['#theme'] = 'short_answer_answering_form';
  $form['tries'] = array(
    '#type' => 'textfield',
    '#title' => t('Answer'),
    '#description' => t('Enter your answer here'),
    '#default_value' => '',
    '#size' => 60,
    '#maxlength' => 256,
    '#required' => FALSE,
  );
  if (isset($rid)) {
    $response = new ShortAnswerResponse($rid, $this->node);
    $form['tries']['#default_value'] = $response
      ->getResponse();
  }
  return $form;
}