| Versionen | |
|---|---|
| drupal6 – drupal7 | drupal_get_form($form_id) |
Wrapper for drupal_build_form() for use when $form_state is not needed.
see drupal_build_form()
$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.
The form array.
includes/
<?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['args'] = $args;
return drupal_build_form($form_id, $form_state);
}
?>
Kommentare
Kommentar hinzufügen