I have a custom content type, not cck, built using the guide, http://drupal.org/node/132845. I'm displaying the form for my content type in two places. Once at the default location, add/node/mytype, and again on a separate page, called via, drupal_get_form('mytype_on_different_page');
I'm also using the event module, and have enabled mytype to be considered an "event".
I'm using hook_forms to add the mytype callback for the mytype_on_differnt_page. The call by drupal_get_forms prints out the form but it does not include any of the form_alter code from the event module.
Why is this? It works fine on the default node/add/mytype page, and I see that node.module does the same thing, http://api.drupal.org/api/function/node_forms/5, so I'm a little lost at the moment.
I first thought that it could be related to the different form name for the second form not being caught by the event modules hook_form_alter, but even hardcoding the 'mytype_on_different_page' form_id into the switch statement did not work.
Anyone shed any light on this.
Regards
Eric.
Comments
A possible clue, many (most)
A possible clue, many (most) modules that alter a node form are looking for information based on node type and generally expect the form id to be of a particular form. They also often look at/expect information placed there by the node module.
Right
Yes, there is some other stuff in there. I'm taking another look at it.
One thing I noticed is that the incoming form does not have any value for $form['type']['#value']. Is that correct?
Added the type on the extra
Added the type on the extra form and the form_alters from the other modules show up on the form, but the form doesn't submit. I compared the additional form with the form from node/add and found these differences.
The node/add/mytype form has 11 extra fields that the other form did not:
nid
vid
uid
created
changed
#node
preview
#after_build
#base
#validate
#submit
node_add holds the key
Normally, when you add any other content type with add/node/sometype, the process starts with the node_add callback from node.module. Thats seems to be the missing key. How to simulate node_add, or something to get the other form to pass through it??
Using node_form
I changed my module's hook_forms to use "node_form" as the callback instead of "mycustomtype_form". Made all the difference. Not sure if this is correct, or if I'm missing some code for my custom content type.