Thanks Earl.  I tried that approach and am still getting the $form before CCK has 
added the additional elements, which is a little confusing to me, because 
ctools/includes/form.inc does seem to be intercepting close enough to render time 
to return it, so I'm guess I need a more populated $form_state to pass into the 
function (currently just using $form_state = array('want form' => TRUE,);)

I'm going to tinker away at it for a bit, but am close to manually creating the 
elements I need inside of my custom form, and submitting them n a custom 
_form_submit.  I was mostly reluctant to do this because it involves a file 
upload with image cropper, and that seems an excessive amount to code when it 
already exists *somewhere*.

Incidentally, would a valid approach be to (*gasp*) hack core to store the 
form_array in question in memcache when a drupal_get_form is called, explicitly 
so I could pull it out of memcache with a var_get?   I just thought of that, so 
maybe it's bunk.

Thanks again, and any advice is appreciated.

-Sam


On Thu, 14 Oct 2010, Earl Miles wrote:

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



Sam Tresler
646-246-8403

Reply via email to