You are here

public function ShortAnswerQuestion::getAnsweringForm in Quiz 7.5

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

Implementation of getAnsweringForm().

Overrides QuizQuestion::getAnsweringForm

See also

QuizQuestion::getAnsweringForm()

File

question_types/short_answer/short_answer.classes.inc, line 121
Short answer classes.

Class

ShortAnswerQuestion
Extension of QuizQuestion.

Code

public function getAnsweringForm(array $form_state = NULL, $result_id) {
  $element = parent::getAnsweringForm($form_state, $result_id);

  //$form['#theme'] = 'short_answer_answering_form';
  $element += 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);
    $element['#default_value'] = $response
      ->getResponse();
  }
  return $element;
}