function ClozeQuestion::_answerJs in Quiz 8.4
1 call to ClozeQuestion::_answerJs()
- ClozeQuestion::getAnsweringForm in question_types/
cloze/ lib/ Drupal/ cloze/ ClozeQuestion.php - Implementation of getAnsweringForm
File
- question_types/
cloze/ lib/ Drupal/ cloze/ ClozeQuestion.php, line 155 - The main classes for the multichoice question type.
Class
- ClozeQuestion
- Extension of QuizQuestion.
Namespace
Drupal\clozeCode
function _answerJs($question) {
$answers = array();
$chunks = _cloze_get_correct_answer_chunks($question);
foreach ($chunks as $key => $chunk) {
$id = 'answer-' . $key;
$answers[$id] = $chunk;
}
foreach ($chunks as $key => $chunk) {
$key = $key - 1;
$id = 'answer-' . $key;
$answers_alt[$id] = $chunk;
}
$answers = array_merge($answers, $answers_alt);
drupal_add_js(array(
'answer' => $answers,
), 'setting');
}