function quiz_nodeapi in Quiz 6.6
Same name and namespace in other branches
- 6.3 quiz.module \quiz_nodeapi()
- 6.4 quiz.module \quiz_nodeapi()
- 6.5 quiz.module \quiz_nodeapi()
Implementation of hook_nodeapi()
File
- ./
quiz.module, line 869 - Quiz Module
Code
function quiz_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
// We need to filter on node type to prevent this from overriding any other node
if ($node->type == 'quiz') {
switch ($op) {
case 'presave':
/*
* 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.
*/
$node->aid = actions_function_lookup($node->aid);
break;
case 'prepare':
// Meet E_STRICT on new nodes.
$defaults = _quiz_get_node_defaults();
if (!isset($node->nid)) {
//drupal_set_message('Building defaults');
foreach ($defaults as $key => $value) {
if (!isset($node->{$key})) {
$node->{$key} = $value;
}
}
}
}
}
/* If we want to pre-process question nodes before they get rendered, here's how to do it:
if ($op == 'view' && in_array($node->type, array_keys(_quiz_get_question_types())) && $a3) {
drupal_set_message("Do global munging of node content here.");
//var_dump($node->content);
}
if ($op == 'alter' && in_array($node->type, array_keys(_quiz_get_question_types())) && $a3) {
drupal_set_message("Do alter of node content here.");
//var_dump($node->content);
}
*/
}