[development] FAPI and _display hook

emanuele quinto emanuele.quinto at gmail.com
Thu Feb 7 09:30:12 UTC 2008


On Feb 7, 2008 9:24 AM, Ivan Sergio Borgonovo <mail at webthatworks.it> wrote:
> On Wed, 6 Feb 2008 19:49:12 -0600
> Larry Garfield <larry at garfieldtech.com> wrote:
>
>
> > It certainly could.  You could easily theme a table and then stick
> > the rendered result in a markup form value, and you're done.
>
> > It has nothing to do with Views, really.  The Theme Wizard is just
> > an example of it that I remember writing.
>
> Thanks.
>
> Emanuele Quinto wrote me about a similar solution for D6 and finally
> I had the chance to see View Wizard.
>
> I find this solution convoluted.
>
> At a first sight furthermore putting stuff in #markup will end up in
> stuff being nested in <form>.

Using  form '#prefix' or '#suffix' you can solve this plain html
outside of <form> tag.

> Anyway this approach incur in another problem... what if your form is
> in an area and your results have to be displayed in another and you
> still need the form?

On the _validate you can do whatever you want: save values with
set_variable or global variable (I know, I know...) or in  a table. In
principle you don't have to wait the _submit.

> At the end of drupal_get_form $form_values/status should be fully
> populated[1] so you could access it through such a global...

$form_status['values'] is populated (in D6):
* if you set $form_status['rebuild'] (in _validate)
* if you set some value in $form_status['storage']

They are available in a _form_alter hook where you can change the
apparence of the form.

You can also use #pre_render
(http://api.drupal.org/api/file/developer/examples/multipage_form_example.module/6):
The #pre_render of a form allows us to make changes AFTER validation
(unlike hook_form_alter()), but BEFORE the form has actually been
displayed. We use it to control which form elements are shown, which
are hidden, and which values to set based on...


ema

-- 
Emanuele Quinto - www.kronstadt.it
------------------------------------------------------------------------------------------------------------------
My mother used to say to me, "Elwood" - she always called me Elwood -
"In this world, Elwood, you must be oh-so smart, or oh-so pleasant."
For years I was smart. I recommend pleasant, and you may quote me.
------------------------------------------------------------------------------------------------------------------


More information about the development mailing list