private function ScaleQuestion::setPreset in Quiz 8.4
Add a preset for the current user.
Parameters
$col_id - answer collection id of the collection this user wants to have as a preset:
2 calls to ScaleQuestion::setPreset()
- ScaleQuestion::saveAnswerCollection in question_types/
scale/ lib/ Drupal/ scale/ ScaleQuestion.php - Stores the answer collection to the database, or identifies an existing collection.
- ScaleQuestion::saveNodeProperties in question_types/
scale/ lib/ Drupal/ scale/ ScaleQuestion.php - Implementation of saveNodeProperties
File
- question_types/
scale/ lib/ Drupal/ scale/ ScaleQuestion.php, line 72 - The main classes for the short answer question type.
Class
- ScaleQuestion
- Extension of QuizQuestion.
Namespace
Drupal\scaleCode
private function setPreset($col_id) {
$user = \Drupal::currentUser();
db_merge('quiz_scale_user')
->key(array(
'uid' => $user
->id(),
'answer_collection_id' => $col_id,
))
->fields(array(
'uid' => $user
->id(),
'answer_collection_id' => $col_id,
))
->execute();
}