You are here

public function LongAnswerQuestion::getAnsweringForm in Quiz 8.4

Implementation of getAnweringForm

Overrides QuizQuestion::getAnsweringForm

See also

QuizQuestion#getAnsweringForm($form_state, $rid)

File

question_types/long_answer/lib/Drupal/long_answer/LongAnswerQuestion.php, line 138
Long answer classes.

Class

LongAnswerQuestion
Extension of QuizQuestion.

Namespace

Drupal\long_answer

Code

public function getAnsweringForm(array $form_state = NULL, $rid) {
  $form = parent::getAnsweringForm($form_state, $rid);
  $form['#theme'] = 'long_answer_answering_form';
  $form['tries'] = 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,
    '#required' => FALSE,
  );
  if (isset($rid)) {
    $response = new LongAnswerResponse($rid, $this->node);
    $form['tries']['#default_value'] = $response
      ->getResponse();
  }
  return $form;
}