[development] Capturing $form array of a specific content type

Sam Tresler sam at treslerdesigns.com
Thu Oct 14 18:08:42 UTC 2010


In this case, no, I'm creating a sort of 'uber' form that based on previous selections displays a different node/add form to the user.  My original plan was to gather all the elements of all the node forms, set them to unrequired, and display them either in a multistep process, or via ajax reveals onclick of the previous elements.

I am going to spend some time taking a look at ctools, and if I don't find what I need there, move on to just creating my own form elements.

Thanks.



On Thu, 14 Oct 2010, Domenic Santangelo wrote:

> 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
>>
>
>

Sam Tresler
646-246-8403



More information about the development mailing list