Select Git revision
Forked from
UNL Information Services / UNL-CMS
59 commits behind the upstream repository.
-
Tim Steiner authoredTim Steiner authored
form.inc 185.96 KiB
<?php
/**
* @file
* Functions for form and batch generation and processing.
*/
/**
* @defgroup forms Form builder functions
* @{
* Functions that build an abstract representation of a HTML form.
*
* All modules should declare their form builder functions to be in this
* group and each builder function should reference its validate and submit
* functions using \@see. Conversely, validate and submit functions should
* reference the form builder function using \@see. For examples, of this see
* system_modules_uninstall() or user_pass(), the latter of which has the
* following in its doxygen documentation:
*
* \@ingroup forms
* \@see user_pass_validate().
* \@see user_pass_submit().
*
* @}
*/
/**
* @defgroup form_api Form generation
* @{
* Functions to enable the processing and display of HTML forms.
*
* Drupal uses these functions to achieve consistency in its form processing and
* presentation, while simplifying code and reducing the amount of HTML that
* must be explicitly generated by modules.
*
* The primary function used with forms is drupal_get_form(), which is
* used for forms presented interactively to a user. Forms can also be built and
* submitted programmatically without any user input using the
* drupal_form_submit() function.
*
* drupal_get_form() handles retrieving, processing, and displaying a rendered
* HTML form for modules automatically.
*
* Here is an example of how to use drupal_get_form() and a form builder
* function:
* @code
* $form = drupal_get_form('my_module_example_form');
* ...
* function my_module_example_form($form, &$form_state) {
* $form['submit'] = array(
* '#type' => 'submit',
* '#value' => t('Submit'),
* );
* return $form;
* }
* function my_module_example_form_validate($form, &$form_state) {
* // Validation logic.
* }
* function my_module_example_form_submit($form, &$form_state) {
* // Submission logic.
* }
* @endcode
*
* Or with any number of additional arguments:
* @code
* $extra = "extra";
* $form = drupal_get_form('my_module_example_form', $extra);
* ...
* function my_module_example_form($form, &$form_state, $extra) {
* $form['submit'] = array(
* '#type' => 'submit',