You are here

private function ScaleQuestion::saveAlternative in Quiz 7

Same name and namespace in other branches
  1. 8.6 question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php \ScaleQuestion::saveAlternative()
  2. 8.5 question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php \ScaleQuestion::saveAlternative()
  3. 6.6 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()
  4. 6.4 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()
  5. 7.6 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()
  6. 7.4 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()
  7. 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 163
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();
}