function node_add
7.x node.pages.inc | node_add($type) |
6.x node.pages.inc | node_add($type) |
Present a node submission form or a set of links to such forms.
1 string reference to 'node_add'
- node_menu in drupal-6.x/
modules/ node/ node.module - Implementation of hook_menu().
File
- drupal-6.x/
modules/ node/ node.pages.inc, line 49 - Page callbacks for adding, editing, deleting, and revisions management for content.
Code
function node_add($type) {
global $user;
$types = node_get_types();
$type = isset($type) ? str_replace('-', '_', $type) : NULL;
// If a node type has been specified, validate its existence.
if (isset($types[$type]) && node_access('create', $type)) {
// Initialize settings:
$node = array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => '');
drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)));
$output = drupal_get_form($type . '_node_form', $node);
}
return $output;
}