You are here

private function ScaleQuestion::saveAlternative in Quiz 8.6

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

string $alternative: The alternative to be saved.

int $answer_collection_id: The id of the answer collection this alternative shall belong to.

1 call to ScaleQuestion::saveAlternative()
ScaleQuestion::saveAnswerCollection in question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php
Stores|Identifies the answer collection.

File

question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php, line 172
Scale classes.

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();
}