You are here

public function ShortAnswerQuestion::getQuestionForm in Quiz 6.3

Same name and namespace in other branches
  1. 6.6 question_types/short_answer/short_answer.classes.inc \ShortAnswerQuestion::getQuestionForm()
  2. 6.5 question_types/short_answer/short_answer.classes.inc \ShortAnswerQuestion::getQuestionForm()

Get the form that will be displayed to the test-taking user.

Parameters

$node: The question node.

$context: The form context.

Return value

Must return a FAPI array.

Overrides QuizQuestion::getQuestionForm

1 call to ShortAnswerQuestion::getQuestionForm()
ShortAnswerQuestion::view in question_types/short_answer/short_answer.classes.inc
Retrieve information relevant for viewing the node. This data is generally added to the node's extra field.

File

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

Class

ShortAnswerQuestion
Implementation of QuizQuestion.

Code

public function getQuestionForm($node, $context = NULL) {
  $form['question'] = array(
    '#type' => 'markup',
    '#value' => check_markup($node->body, $node->format),
  );
  $form['tries'] = array(
    '#type' => 'textfield',
    '#title' => t('Answer'),
    '#description' => t('Enter your answer here'),
    '#default_value' => isset($context['tries']) ? $context['tries'] : '',
    '#size' => 60,
    '#maxlength' => 256,
    '#required' => FALSE,
  );
  return $form;
}