[development] finding the $form_id of a particular form / all forms.

Heine Deelstra info at ustilago.org
Sat Jul 1 11:17:47 UTC 2006


On Sat, 01 Jul 2006 12:05:39 +0200, Augustin (a.k.a. Beginner)  
<drupal.beginner at wechange.org> wrote:

>
> Hello,
>
> hook_form_alter() allows us to change forms according to their form_id:
> http://api.drupal.org/api/HEAD/function/hook_form_alter
>
> Am I missing something easy, or the only way to figure out what is the  
> form_id
> of a specific form is to pour over the code and figure out which module
> initialized the said form?
> Devel.module doesn't seem to help with that.
>
> thanks,
>
> Augustin.

Make a module (here test.module):
<?php
function test_form_alter($form_id, &$form) {
   $form['test_form_id_display'] = array('#weight' => -20, '#type' =>  
'markup', '#value' => check_plain($form_id));
}

Voila.

Regards,

Heine

// yes, I may be paranoid.


More information about the development mailing list