You are here

function quiz_node_prepare in Quiz 7

Same name and namespace in other branches
  1. 8.6 quiz.module \quiz_node_prepare()
  2. 8.5 quiz.module \quiz_node_prepare()
  3. 7.6 quiz.module \quiz_node_prepare()
  4. 7.4 quiz.module \quiz_node_prepare()
  5. 7.5 quiz.module \quiz_node_prepare()

Implementation of hook_node_prepare().

File

./quiz.module, line 1464
Quiz Module

Code

function quiz_node_prepare($node) {
  if ($node->type == 'quiz') {
    $defaults = _quiz_get_node_defaults();
    if (!isset($node->nid)) {
      foreach ($defaults as $key => $value) {
        if (!isset($node->{$key})) {
          $node->{$key} = $value;
        }
      }
    }
  }
  if (isset($node->is_quiz_question)) {
    if (variable_get('quiz_auto_revisioning', 1)) {
      $node->revision = quiz_question_has_been_answered($node) ? 1 : 0;
    }
  }
}