You are here

public function ClozeQuestion::validateNode in Quiz 8.4

Implementation of validateNode

Overrides QuizQuestion::validateNode

See also

QuizQuestion#validateNode($form_state)

File

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

Class

ClozeQuestion
Extension of QuizQuestion.

Namespace

Drupal\cloze

Code

public function validateNode(array &$form_state) {
  if (substr_count($form_state['values']['body']['0']['value'], '[') !== substr_count($form_state['values']['body']['0']['value'], ']')) {
    form_set_error('body', $form_state, t('Please check the question format.'));
  }
}