private function ScaleQuestion::saveAlternative in Quiz 8.4
Saves one alternative to the database
Parameters
$alternative - the alternative(String) to be saved.:
$answer_collection_id - the id of the answer collection this alternative shall belong to.:
1 call to ScaleQuestion::saveAlternative()
- ScaleQuestion::saveAnswerCollection in question_types/
scale/ lib/ Drupal/ scale/ ScaleQuestion.php - Stores the answer collection to the database, or identifies an existing collection.
File
- question_types/
scale/ lib/ Drupal/ scale/ ScaleQuestion.php, line 166 - The main classes for the short answer question type.
Class
- ScaleQuestion
- Extension of QuizQuestion.
Namespace
Drupal\scaleCode
private function saveAlternative($alternative, $answer_collection_id) {
$id = db_insert('quiz_scale_answer')
->fields(array(
'answer_collection_id' => $answer_collection_id,
'answer' => $alternative,
))
->execute();
}