Skip to content
Snippets Groups Projects
Select Git revision
  • issue-703
  • master default
  • issue-752
  • develop
  • issue-677
  • issue-677-original-with-migrate
  • issue-716
  • issue-654
  • issue-732
  • issue-737
  • issue-735
  • issue-707
  • issue-706
  • issue-705
  • issue-696
  • issue-690
  • issue-675
  • issue-670
  • issue-635
  • issue-404
  • 7.19
  • 2012-04-18
  • 2012-04-03
  • 2012-04-02
  • 2012-03-01
  • 2012-02-07
  • 20120207
  • 2012-01-13
  • 2012-01-12
  • 2011-12-16
  • 2011-12-05
  • 2011-11-17
  • 2011-11-14
  • 2011-11-08.2
  • 2011-11-08
  • 2011-11-01
  • 2011-10-27
  • 2011-10-06
  • 2011-10-03
  • 2011-09-19
40 results

form.inc

Blame
  • Forked from UNL Information Services / UNL-CMS
    59 commits behind the upstream repository.
    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',