You are here

public function QuizQuestion::delete in Quiz 8.4

Delete question data from the database.

Called by quiz_question_delete (hook_delete). Child classes must call super

Parameters

$only_this_version: If the $only_this_version flag is TRUE, then only the particular nid/vid combo should be deleted. Otherwise, all questions with the current nid can be deleted.

8 calls to QuizQuestion::delete()
ClozeQuestion::delete in question_types/cloze/lib/Drupal/cloze/ClozeQuestion.php
Implementation of delete()
DDLinesQuestion::delete in question_types/quiz_ddlines/lib/Drupal/quiz_ddlines/DDLinesQuestion.php
Implementation of delete
LongAnswerQuestion::delete in question_types/long_answer/lib/Drupal/long_answer/LongAnswerQuestion.php
Implementation of delete
MatchingQuestion::delete in question_types/matching/lib/Drupal/matching/MatchingQuestion.php
Implementation of delete
MultichoiceQuestion::delete in question_types/multichoice/lib/Drupal/multichoice/MultichoiceQuestion.php
Implementation of delete

... See full list

8 methods override QuizQuestion::delete()
ClozeQuestion::delete in question_types/cloze/lib/Drupal/cloze/ClozeQuestion.php
Implementation of delete()
DDLinesQuestion::delete in question_types/quiz_ddlines/lib/Drupal/quiz_ddlines/DDLinesQuestion.php
Implementation of delete
LongAnswerQuestion::delete in question_types/long_answer/lib/Drupal/long_answer/LongAnswerQuestion.php
Implementation of delete
MatchingQuestion::delete in question_types/matching/lib/Drupal/matching/MatchingQuestion.php
Implementation of delete
MultichoiceQuestion::delete in question_types/multichoice/lib/Drupal/multichoice/MultichoiceQuestion.php
Implementation of delete

... See full list

File

question_types/quiz_question/lib/Drupal/quiz_question/QuizQuestion.php, line 409
Classes used in the Quiz Question module.

Class

QuizQuestion
A base implementation of a quiz_question, adding a layer of abstraction between the node API, quiz API and the question types.

Namespace

Drupal\quiz_question

Code

public function delete($only_this_version = FALSE) {

  // Delete answeres
  $delete = db_delete('quiz_node_results_answers')
    ->condition('question_nid', $this->node
    ->id());
  if ($only_this_version) {
    $delete
      ->condition('question_vid', $this->node
      ->getRevisionId());
  }
  $delete
    ->execute();

  // Delete properties
  $delete = db_delete('quiz_question_properties')
    ->condition('nid', $this->node
    ->id());
  if ($only_this_version) {
    $delete
      ->condition('vid', $this->node
      ->getRevisionId());
  }
  $delete
    ->execute();
}