public function ScaleQuestion::delete in Quiz 8.4
Implementation of delete
Overrides QuizQuestion::delete
See also
QuizQuestion#delete()
File
- question_types/
scale/ lib/ Drupal/ scale/ ScaleQuestion.php, line 293 - The main classes for the short answer question type.
Class
- ScaleQuestion
- Extension of QuizQuestion.
Namespace
Drupal\scaleCode
public function delete($only_this_version = FALSE) {
parent::delete($only_this_version);
if ($only_this_version) {
db_delete('quiz_scale_user_answers')
->condition('question_nid', $this->node
->id())
->condition('question_vid', $this->node
->getRevisionId())
->execute();
db_delete('quiz_scale_node_properties')
->condition('nid', $this->node
->id())
->condition('vid', $this->node
->getRevisionId())
->execute();
}
else {
db_delete('quiz_scale_user_answers')
->condition('question_nid', $this->node
->id())
->execute();
db_delete('quiz_scale_node_properties')
->condition('nid', $this->node
->id())
->execute();
}
$this
->deleteCollectionIfNotUsed($this->node->{0}->answer_collection_id, 0);
}