public function TrueFalseQuestion::getNodeProperties in Quiz 8.4
Implementation of getNodeProperties
Overrides QuizQuestion::getNodeProperties
See also
QuizQuestion#getNodeProperties()
File
- question_types/
truefalse/ lib/ Drupal/ truefalse/ TrueFalseQuestion.php, line 95 - Defines the classes necessary for a True/False quiz.
Class
- TrueFalseQuestion
- Extension of QuizQuestion.
Namespace
Drupal\truefalseCode
public function getNodeProperties() {
if (isset($this->nodeProperties)) {
return $this->nodeProperties;
}
$props = parent::getNodeProperties();
if ($this->node instanceof \stdClass) {
$params = array(
':nid' => $this->node->nid,
':vid' => $this->node->vid,
);
}
else {
$params = array(
':nid' => $this->node
->id(),
':vid' => $this->node
->getRevisionId(),
);
}
$res_a = db_query('SELECT correct_answer, feedback FROM {quiz_truefalse_node} WHERE nid = :nid AND vid = :vid', $params)
->fetchAssoc();
if (is_array($res_a)) {
$props = array_merge($props, $res_a);
}
$this->nodeProperties = $props;
return $props;
}