private function MultichoiceQuestion::shuffle in Quiz 8.4
Custom shuffle function. It keeps the array key - value relationship intact
Parameters
array $array:
Return value
unknown_type
2 calls to MultichoiceQuestion::shuffle()
- MultichoiceQuestion::getAnsweringForm in question_types/
multichoice/ lib/ Drupal/ multichoice/ MultichoiceQuestion.php - Generates the question form.
- MultichoiceQuestion::getNodeView in question_types/
multichoice/ lib/ Drupal/ multichoice/ MultichoiceQuestion.php - Implementation of getNodeView
File
- question_types/
multichoice/ lib/ Drupal/ multichoice/ MultichoiceQuestion.php, line 457 - The main classes for the multichoice question type.
Class
- MultichoiceQuestion
- Extension of QuizQuestion.
Namespace
Drupal\multichoiceCode
private function shuffle(array &$array) {
$newArray = array();
$toReturn = array_keys($array);
shuffle($toReturn);
foreach ($toReturn as $key) {
$newArray[$key] = $array[$key];
}
$array = $newArray;
return $toReturn;
}