Documentation does not match source for D6: drupal_get_form (extra args not passed to form constructor)

tmaxwell - October 6, 2008 - 17:28
Project:Drupal
Version:6.x-dev
Component:documentation
Category:bug report
Priority:normal
Assigned:Unassigned
Status:won't fix
Description

The documentation says that any extra arguments fed to drupal_get_form are passed on to the form constructor. After some testing and looking at the source, that appears to only happen in the multistage form case.

#1

kbahey - October 6, 2008 - 18:04
Project:Drupal.org infrastructure» Drupal
Version:<none>» 6.x-dev
Component:Other» documentation

Changing that to be a documentation issue, not infrastructure.

#2

merlinofchaos - October 6, 2008 - 19:25
Status:active» won't fix

1) the documentation is not specific. You need to reference a specific piece of documentation, unless you assume that there's anyone who actually has the entirely of drupal documentation memorized and knows exactly where a given piece is.

2) If you're referring to api.drupal.org documentation, that documentation is generated from code comments by api.module, and would be a bug against the code itself.

3) I think you're wrong. Those arguments do always get passed on (unless the form was retrieved from cache, anyhow) This feature is critical, and it does work, or a LOT of forms in Drupal core would completely fail. Here is the relevant code:

<?php
      $args_temp
= $args;
     
$args_temp[0] = &$form_state;
     
array_unshift($args_temp, $form_id);

     
$form = call_user_func_array('drupal_retrieve_form', $args_temp);
?>

drupal_retrieve_form() then goes on to do some processing and passes those args through:

<?php
  $form
= call_user_func_array(isset($callback) ? $callback : $form_id, $args);
?>

This happens whether or not the form is multistage (in fact, there isn't really an explicit multistage form case anymore).

 
 

Drupal is a registered trademark of Dries Buytaert.