private function ScaleQuestion::saveAlternative in Quiz 7.6
Same name and namespace in other branches
- 8.6 question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php \ScaleQuestion::saveAlternative()
- 8.5 question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php \ScaleQuestion::saveAlternative()
- 6.6 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()
- 6.4 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()
- 7 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()
- 7.4 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()
- 7.5 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()
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/ scale.classes.inc - Stores the answer collection to the database, or identifies an existing collection.
File
- question_types/
scale/ scale.classes.inc, line 162 - The main classes for the scale question type.
Class
- ScaleQuestion
- Extension of QuizQuestion.
Code
private function saveAlternative($alternative, $answer_collection_id) {
$id = db_insert('quiz_scale_answer')
->fields(array(
'answer_collection_id' => $answer_collection_id,
'answer' => $alternative,
))
->execute();
}