function addanother_nodeapi in Add Another 5
Same name and namespace in other branches
- 6 addanother.module \addanother_nodeapi()
Implementation of hook_nodeapi().
File
- ./
addanother.module, line 65 - Presents users with an option to create another node of the same type after a node is added.
Code
function addanother_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
switch ($op) {
case 'insert':
if ($node->op == t('Save and create another')) {
// This prevents AddAnother's message from clashing with Submit Again.
return;
}
$allowed_nodetypes = variable_get('addanother_nodetypes', array());
if (user_access('enable 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;
}
}