[drupal-devel] hook_form

Karoly Negyesi karoly at negyesi.net
Tue Jun 28 18:03:18 UTC 2005


hook_form(&$node, &$param)

&$node The node being added or edited. 
&$param The hook can set this variable to an associative array of attributes 
to add to the enclosing \<form\> tag.

Return value

A string containing HTML defining form elements to be displayed in the node 
edit form.

This is called from:

  // Get the node-specific bits.
  // We can't use node_invoke() because $param must be passed by reference.
  $function = node_get_module_name($edit) .'_form';
  $param = array();
  if (function_exists($function)) {
    $form .= $function($edit, $param);
  }

My question is: why $node is a reference form hook_form? To edit the node we 
have hook_load and hook_validate. I propose changing the documentation. 
Still a module author can write &$node and edit $node in his _form but at 
least do not document it so.

Regards

NK



More information about the drupal-devel mailing list