You are here

public function LongAnswerQuestion::getCreationForm in Quiz 8.6

Same name and namespace in other branches
  1. 8.5 question_types/quiz_long_answer/src/Plugin/quiz/QuizQuestion/LongAnswerQuestion.php \Drupal\quiz_long_answer\Plugin\quiz\QuizQuestion\LongAnswerQuestion::getCreationForm()
  2. 6.x question_types/quiz_long_answer/src/Plugin/quiz/QuizQuestion/LongAnswerQuestion.php \Drupal\quiz_long_answer\Plugin\quiz\QuizQuestion\LongAnswerQuestion::getCreationForm()

Implementation of getCreationForm().

See also

QuizQuestion::getCreationForm()

File

question_types/quiz_long_answer/src/Plugin/quiz/QuizQuestion/LongAnswerQuestion.php, line 97

Class

LongAnswerQuestion
@QuizQuestion ( id = "long_answer", label = Plugin annotation @Translation("Long answer question"), handlers = { "response" = "\Drupal\quiz_long_answer\Plugin\quiz\QuizQuestion\LongAnswerResponse" } )

Namespace

Drupal\quiz_long_answer\Plugin\quiz\QuizQuestion

Code

public function getCreationForm(array &$form_state = NULL) {
  $form = array();
  $form['rubric'] = array(
    '#type' => 'text_format',
    '#title' => t('Rubric'),
    '#description' => t('Specify the criteria for grading the response.'),
    '#default_value' => isset($this->node->rubric['value']) ? $this->node->rubric['value'] : '',
    '#format' => isset($this->node->rubric['format']) ? $this->node->rubric['format'] : filter_default_format(),
    '#size' => 60,
    '#required' => FALSE,
  );
  $form['answer_text_processing'] = array(
    '#title' => t('Answer text processing'),
    '#description' => t('Allowing filtered text may enable the user to input HTML tags in their answer.'),
    '#type' => 'radios',
    '#options' => array(
      0 => t('Plain text'),
      1 => t('Filtered text (user selects text format)'),
    ),
    '#default_value' => isset($this->node->answer_text_processing) ? $this->node->answer_text_processing : 0,
  );
  return $form;
}