function quiz_node_presave in Quiz 8.4
Same name and namespace in other branches
- 8.6 quiz.module \quiz_node_presave()
- 8.5 quiz.module \quiz_node_presave()
- 7.6 quiz.module \quiz_node_presave()
- 7 quiz.module \quiz_node_presave()
- 7.4 quiz.module \quiz_node_presave()
- 7.5 quiz.module \quiz_node_presave()
Implementation of hook_node_presave().
File
- ./
quiz.module, line 2440 - Quiz Module
Code
function quiz_node_presave(EntityInterface $node) {
if ($node
->getType() == 'quiz') {
// Convert the action id to the actual id from the MD5 hash.
// Why the actions module does this I do not know? Maybe to prevent
// invalid values put into the options value="" field.
if (!empty($node->aid) && ($aid = actions_function_lookup($node->aid))) {
$node->aid = $aid;
}
if (\Drupal::config('quiz.settings')
->get('quiz_auto_revisioning')) {
$node->revision = quiz_has_been_answered($node) ? 1 : 0;
}
}
if (isset($node->is_quiz_question) && \Drupal::config('quiz.settings')
->get('quiz_auto_revisioning')) {
$node->revision = quiz_question_has_been_answered($node) ? 1 : 0;
}
}