You are here

public function ClozeQuestion::getCreationForm in Quiz 8.4

Implementation of getCreationForm

Overrides QuizQuestion::getCreationForm

See also

QuizQuestion#getCreationForm($form_state)

File

question_types/cloze/lib/Drupal/cloze/ClozeQuestion.php, line 246
The main classes for the multichoice question type.

Class

ClozeQuestion
Extension of QuizQuestion.

Namespace

Drupal\cloze

Code

public function getCreationForm(array &$form_state = NULL) {
  $module_path = drupal_get_path('module', 'cloze');
  drupal_add_css($module_path . '/css/cloze.css');
  $form['instructions'] = array(
    '#markup' => '<div class="cloze-instruction">' . t('For free text cloze, mention the correct answer inside the square bracket. For multichoice cloze, provide the options separated by commas with correct answer as first. <br/>Example question: [The] Sun raises in the [east, west, north, south]. <br/>Answer: <span class="answer correct correct-answer">The</span> Sun raises in the <span class="answer correct correct-answer">east</span>.') . '</div>',
    '#weight' => -10,
  );
  $form['learning_mode'] = array(
    '#type' => 'checkbox',
    '#default_value' => $this->node->learning_mode,
    '#title' => t('Allow right answers only'),
    '#description' => t('This is meant to be used for learning purpose. If this option is enabled only the right answers will be accepted.'),
  );
  return $form;
}