function addanother_nodeapi in Add Another 6
Same name and namespace in other branches
- 5 addanother.module \addanother_nodeapi()
Implementation of hook_nodeapi().
File
- ./
addanother.module, line 133 - Presents users with an option to create another node of the same type after a node is added.
Code
function addanother_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
switch ($op) {
case 'insert':
if ($node->op == t('Save and create another')) {
// This prevents Add another's message from clashing with Submit Again.
return;
}
$allowed_nodetypes = variable_get('addanother_nodetypes', array());
if (user_access('use add another') && isset($allowed_nodetypes[$node->type]) && $allowed_nodetypes[$node->type]) {
global $_addanother_message;
$_addanother_message = t('Add another <a href="@typeurl">%type</a>.', array(
'@typeurl' => url('node/add/' . str_replace('_', '-', $node->type)),
'%type' => node_get_types('name', $node),
));
}
break;
}
}