public function ShortAnswerQuestion::saveNodeProperties in Quiz 8.4
Implementation of saveNodeProperties
Overrides QuizQuestion::saveNodeProperties
See also
QuizQuestion#saveNodeProperties($is_new)
File
- question_types/
short_answer/ lib/ Drupal/ short_answer/ ShortAnswerQuestion.php, line 34 - The main classes for the short answer question type.
Class
- ShortAnswerQuestion
- Extension of QuizQuestion.
Namespace
Drupal\short_answerCode
public function saveNodeProperties($is_new = FALSE) {
if ($is_new || $this->node
->isNewRevision() == 1) {
$id = db_insert('quiz_short_answer_node_properties')
->fields(array(
'nid' => $this->node
->id(),
'vid' => $this->node
->getRevisionId(),
'correct_answer' => $this->node->correct_answer,
'correct_answer_evaluation' => $this->node->correct_answer_evaluation,
))
->execute();
}
else {
db_update('quiz_short_answer_node_properties')
->fields(array(
'correct_answer' => $this->node->correct_answer,
'correct_answer_evaluation' => $this->node->correct_answer_evaluation,
))
->condition('nid', $this->node
->id())
->condition('vid', $this->node
->getRevisionId())
->execute();
}
}