Skip to content

Instantly share code, notes, and snippets.

@lcube45
Last active September 28, 2016 13:25
Show Gist options
  • Save lcube45/d8477b1be042cefd8fbb334d97302b6f to your computer and use it in GitHub Desktop.
Save lcube45/d8477b1be042cefd8fbb334d97302b6f to your computer and use it in GitHub Desktop.
Drupal 7 - embed node form
function my_custom_form_callback($type = 'page') {
global $user;
module_load_include('inc', 'node', 'node.pages');
$node = (object) array(
'uid' => $user->uid,
'name' => (isset($user->name) ? $user->name : ''),
'type' => $type,
'language' => LANGUAGE_NONE
);
$form = drupal_get_form($type . '_node_form', $node);
return $form;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment