You are here

public function LongAnswerQuestion::getAnsweringForm in Quiz 7.6

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

Implementation of getAnweringForm

Overrides QuizQuestion::getAnsweringForm

See also

QuizQuestion#getAnsweringForm($form_state, $result_id)

File

question_types/long_answer/long_answer.classes.inc, line 128
Long answer classes.

Class

LongAnswerQuestion
Extension of QuizQuestion.

Code

public function getAnsweringForm(array $form_state = NULL, $result_id) {
  $element = parent::getAnsweringForm($form_state, $result_id);
  $element += array(
    '#type' => 'textarea',
    '#title' => t('Answer'),
    '#description' => t('Enter your answer here. If you need more space, click on the grey bar at the bottom of this area and drag it down.'),
    '#rows' => 15,
    '#cols' => 60,
  );
  if (isset($result_id)) {
    $response = new LongAnswerResponse($result_id, $this->node);
    $element['#default_value'] = $response
      ->getResponse();
  }
  return $element;
}