You are here

public function QuizQuestion::getNodeProperties in Quiz 8.4

Getter function returning properties to be loaded when the node is loaded.

Return value

array

See also

load hook in quiz_question.module (quiz_question_load)

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

... See full list

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

... See full list

File

question_types/quiz_question/lib/Drupal/quiz_question/QuizQuestion.php, line 316
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 getNodeProperties() {
  if (isset($this->nodeProperties)) {
    return $this->nodeProperties;
  }

  //TODO: Find right way.
  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(),
    );
  }
  $sql = 'SELECT max_score
            FROM {quiz_question_properties}
            WHERE nid = %d AND vid = %d';
  $props['max_score'] = db_query('SELECT max_score
            FROM {quiz_question_properties}
            WHERE nid = :nid AND vid = :vid', $params)
    ->fetchField();
  $props['is_quiz_question'] = TRUE;
  $this->nodeProperties = $props;
  return $props;
}