You are here

public function ClozeQuestion::saveNodeProperties in Quiz 8.4

Implementation of saveNodeProperties

Overrides QuizQuestion::saveNodeProperties

See also

QuizQuestion#saveNodeProperties($is_new)

File

question_types/cloze/lib/Drupal/cloze/ClozeQuestion.php, line 39
The main classes for the multichoice question type.

Class

ClozeQuestion
Extension of QuizQuestion.

Namespace

Drupal\cloze

Code

public function saveNodeProperties($is_new = FALSE) {
  if ($is_new || $this->node
    ->isNewRevision()) {
    $id = db_insert('quiz_cloze_node_properties')
      ->fields(array(
      'nid' => $this->node
        ->id(),
      'vid' => $this->node
        ->getRevisionId(),
      'learning_mode' => $this->node->learning_mode,
    ))
      ->execute();
  }
  else {
    db_update('quiz_cloze_node_properties')
      ->fields(array(
      'learning_mode' => $this->node->learning_mode,
    ))
      ->condition('nid', $this->node
      ->id())
      ->condition('vid', $this->node
      ->getRevisionId())
      ->execute();
  }
}