function devel_generate_nodeapi in Devel 6
File
- ./
devel_generate.inc, line 487
Code
function devel_generate_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
if (isset($node->devel_generate)) {
$results = $node->devel_generate;
switch ($op) {
// Modules that want to affect generated nodes may implement hook_nodeapi('presave'). See OG module or CCK.
// A few implementations live here because core doesn't do bulk node generation.
case 'presave':
if ($results['add_upload']) {
devel_generate_add_upload($node);
}
if ($results['add_terms']) {
devel_generate_add_terms($node);
}
if (isset($results['add_language']) && variable_get('language_content_type_' . $node->type, 0)) {
$languages = array_keys($results['add_language']);
$node->language = $languages[array_rand($languages)];
}
break;
case 'insert':
if ($results['max_comments'] && $node->comment >= COMMENT_NODE_READ_WRITE) {
devel_generate_add_comments($node, $results['users'], $results['max_comments'], $results['title_length']);
}
// Add an url alias. Cannot happen before save becasue we don't know the nid.
if ($results['add_alias']) {
path_set_alias("node/{$node->nid}", "node-{$node->nid}-{$node->type}");
}
// Add node statistics.
if ($results['add_statistics']) {
devel_generate_add_statistics($node);
}
break;
}
}
}