function node_add in Drupal 7
Same name and namespace in other branches
- 4 modules/node.module \node_add()
- 5 modules/node/node.module \node_add()
- 6 modules/node/node.pages.inc \node_add()
Returns a node submission form.
Parameters
$type: The node type for the submitted node.
Return value
The themed form.
1 string reference to 'node_add'
- node_menu in modules/
node/ node.module - Implements hook_menu().
File
- modules/
node/ node.pages.inc, line 72 - Page callbacks for adding, editing, deleting, and revisions management for content.
Code
function node_add($type) {
global $user;
$types = node_type_get_types();
$node = (object) array(
'uid' => $user->uid,
'name' => isset($user->name) ? $user->name : '',
'type' => $type,
'language' => LANGUAGE_NONE,
);
drupal_set_title(t('Create @name', array(
'@name' => $types[$type]->name,
)), PASS_THROUGH);
$output = drupal_get_form($type . '_node_form', $node);
return $output;
}