You are here

public function ShortAnswerQuestion::getNodeProperties in Quiz 8.4

Implementation of getNodeProperties

Overrides QuizQuestion::getNodeProperties

See also

QuizQuestion#getNodeProperties()

File

question_types/short_answer/lib/Drupal/short_answer/ShortAnswerQuestion.php, line 105
The main classes for the short answer question type.

Class

ShortAnswerQuestion
Extension of QuizQuestion.

Namespace

Drupal\short_answer

Code

public function getNodeProperties() {
  if (isset($this->nodeProperties)) {
    return $this->nodeProperties;
  }
  $props = parent::getNodeProperties();
  $res_a = db_query('SELECT correct_answer, correct_answer_evaluation FROM {quiz_short_answer_node_properties}
      WHERE nid = :nid AND vid = :vid', array(
    ':nid' => $this->node
      ->id(),
    ':vid' => $this->node
      ->getRevisionId(),
  ))
    ->fetchAssoc();
  $this->nodeProperties = is_array($res_a) ? array_merge($props, $res_a) : $props;
  return $this->nodeProperties;
}