[development] getting the full $form in 5.x

Peter Wolanin pwolanin at gmail.com
Thu Dec 7 15:21:38 UTC 2006


I'm asking in the context of this issue:


I'd like to be able to collect the array keys for all the form values
that come about as a result of hook_form_alter.  This way when a node
type is deleted, the corresponding variables could be automatically
deleted, rather than requiring modules to implement hook_node_type for
this one simple case.  In other words, I'd like to maybe separate out
or duplicate the code in node_type_form_submit that saves/updates
items in the variable table.


Date: Thu, 07 Dec 2006 05:36:57 +0100 (CET)
From: "Karoly Negyesi" <karoly at negyesi.net>
Subject: Re: [development] getting the full $form in 5.x
To: development at drupal.org
Message-ID: <E1GsB0D-0002Jn-QZ at fenris.runbox.com>
Content-Type: text/plain; charset="iso-8859-1"

> Drupal 5.x to get the full form corresponding to a particular form ID?
>  Specifically, I want to have the $form with all the elements added
> via hook_form_alter, but without rendering the $form.

If this is what you want then indeed you need two steps. As you have
not outlined what do you want to do with the form, I can't really
guess a better way. Maybe you want to do

$form = drupal_retrieve_form($form_id);
drupal_prepare_form($form_id, $form);

or even drupal_process_form($form_id, $form);

Eaton did a very good job in slicing up the form workflow steps into
separate functions -- but if you want half of a step, then you indeed
need do it for yourself.

More information about the development mailing list