drupal_get_form

Versions
4.7
drupal_get_form($form_id, &$form, $callback = NULL)
5 – 7
drupal_get_form($form_id)

Wrapper for drupal_build_form() for use when $form_state is not needed.

See also

drupal_build_form()

Parameters

$form_id The unique string identifying the desired form. If a function with that name exists, it is called to build the form array. Modules that need to generate the same form (or very similar forms) using different $form_ids can implement hook_forms(), which maps different $form_id values to the proper form constructor function. Examples may be found in node_forms(), search_forms(), and user_forms().

... Any additional arguments are passed on to the functions called by drupal_get_form(), including the unique form constructor function. For example, the node_edit form requires that a node object is passed in here when it is called.

Return value

The form array.

Related topics

▾ 3 functions call drupal_get_form()

comment_node_page_additions in modules/comment/comment.module
Build the comment-related elements for node detail pages.
trigger_assign in modules/trigger/trigger.admin.inc
Builds the form that allows users to assign actions to triggers.
user_block_view in modules/user/user.module
Implement hook_block_view().

Code

includes/form.inc, line 68

<?php
function drupal_get_form($form_id) {
  $form_state = array();

  $args = func_get_args();
  // Remove $form_id from the arguments.
  array_shift($args);
  $form_state['build_info']['args'] = $args;

  return drupal_build_form($form_id, $form_state);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.