Custom module embedding existing node form I have the following content types: 


event
signup


I'm dealing with my_singnup module, for which I wish to:


allow user to add signup content (same as core node/add/signup)
using signup/event/%eventid path (it is simple link expose in every event)
presenting (while adding) some information from event in left side
and node/add/signup form on the right side
preventing signup/event without argument to run


The code I have already wrote is the following.

function my_singnup_menu() {
   $items = array();
   $items['signup/event'] = array(
     'title' =&gt; 'Sorry, no such event.',
     'page callback' =&gt; 'There is no event id in path.',
     'type' =&gt; MENU_CALLBACK,
     'access callback' =&gt; TRUE // for now
   );

   $items['signup/event/%eventid'] = array(
     'title' =&gt; 'Signing up for event',
     'title callback' =&gt; 'my_signup_title',
     'title arguments' =&gt; array(2),
     'page callback' =&gt; 'my_singnup',
     'page arguments' =&gt; array(2),
     'type' =&gt; MENU_CALLBACK,
     'access callback' =&gt; TRUE // for now
   );
   return $items;
}

function my_signup_title($node) {
  if ($node-&gt;type == 'event') {
  drupal_set_title(t('Signing up for event '.$node-&gt;title));
  }
  if ($node-&gt;type &lt;&gt; 'event') {
  drupal_set_title(t('Id in path is not event id.'));
  }
  return t('Signing up for event');
}

function my_signup($node = FALSE) {
   if($node) {
     if($node-&gt;type == 'event') {
       module_load_include('inc', 'node', 'node.pages'); //Added
       global $user; //Added
       $new_node = new stdClass; //Added
       $new_node-&gt;type = 'signup'; //Added - here was bug
       $new_node-&gt;language = LANGUAGE_NONE; //localization
       $new_node-&gt;user = $user-&gt;uid; //Added
       $new_node-&gt;name = (isset($user-&gt;name) ? $user-&gt;name : ''); //Added
       $form = drupal_get_form('signup_node_form', $new_node); //here was my big trouble
       return $form;
     }
   }
   return drupal_not_found();
}

function my_signup_theme($existing, $type, $theme, $path) {
  return array(
    'signup_node_form' =&gt; array(
      'render element' =&gt; 'form',
      'template' =&gt; 'signup-node-form',
      'path' =&gt; drupal_get_path('module', 'my_signup'),
    ),
  );
}


Right now, I see some form under event/signup/999 (thats good), but there is no custom groups and fields like in core default node/add/signup. I was so happy to see it that I forget to check it looks the same. I see only core vertical tabs such as Menu, Book, Version, Adress, Comments, and there is no custom fields and groups in it. It is strange.
node_form() is in node.pages.inc which isn't included by default. Just add a call like this to the beginning of your my_signup() function:

module_load_include('inc', 'node', 'node.pages');


When you call drupal_get_form() with a specific type (like signup_node_form) the node module internally translates that to node_form(). This happens in node_forms() which is in the node.module file, and as such is always included. 

However node.pages.inc is only included when specifically requested by a module/menu callback etc. so to use node_form() you'll need to include the file manually.

You also need to pass a node object to the function with the required content type assigned like the following code:

$new_node = new stdClass;
$new_node-&gt;type = 'signup';
$new_node-&gt;language = LANGUAGE_NONE;
$form = drupal_get_form('signup_node_form', $new_node);