[development] Capturing $form array of a specific content type
Earl Miles
merlin at logrus.com
Thu Oct 14 17:41:36 UTC 2010
There is no easy way to get this with Drupal.
If you're using CTools, you can use ctools_build_form with 'want form'
=> TRUE in the $form_state.
On 10/14/2010 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