| 5 node.module | node_add($type = NULL) |
| 6 node.pages.inc | node_add($type) |
| 7 node.pages.inc | node_add($type) |
| 8 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'
File
- modules/
node/ node.pages.inc, line 46 - 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;
}
Login or register to post comments