[development] Capturing $form array of a specific content type
Domenic Santangelo
domenics at gmail.com
Thu Oct 14 17:54:10 UTC 2010
Would hook_form_alter()'ing the node/add form you're operating on not work for your purpose?
On Oct 14, 2010, at 10:31 AM, Sam Tresler wrote:
> Could be I am missing something easy here, but is there a standard way to get the $form array of a node/add/* right before it would be rendered. Basically, I want it after all the hook_form_alters ave happened, but I want the array, not the html drupal_render generates?
>
> I'm working on a custom form that I want to potentially create several nodes. I could just manually create the same fields and then deal with the submit, but it seems to me that they must already exist *exactly* how I want them anyway. Currently I have the following:
>
> function my_form($form, &$form_state) {
> $my_form = array();
>
> // Some fields added to $my_form...
>
> $fake_node->type = 'my_content_type';
>
> $node_form = node_form(&$form_state, $fake_node);
>
> $form = array_merge($node_form, $form);
>
> //More fields added to $my_form...
>
> return $form;
> }
>
> However, that just gives me the standard node fields, not the CCK fields that exist in my_content_type.
>
> Thanks in advance if anyone can help.
>
> Sam Tresler
> 646-246-8403
>
More information about the development
mailing list