Forms

Categories

Component ID

1509818

Component name

Forms

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

1135

Component created

Component changed

Component body

Forms is a light-weight Forms API helper module.
It creates a registry that can hold lists of files to be included for each custom form.
This module helps developers
- avoid duplicate code,
- organize their code in a more efficient structure (more files is sometimes better)
- include files in a standard fashion
.

In order to register these files, developers must implement hook_forms_registry().

/**
 * Implements hook_forms_registry().
 */
function forms_test_forms_registry() {
  $items = array();

  $items['forms_test_simple_form'] = array(
    'files' => array(
      array(
        'ext' => 'inc',
        'module' => 'forms_test',
        'name' => 'forms/simple_test',
      ),
      array(
        'ext' => 'inc',
        'module' => 'forms_test',
        'name' => 'forms/countries',
      ),
    ),
  );

  return $items;
}

In order to get the desired form and include the necessary files, the module also provides a light-weight wrapper over drupal_get_form().

forms_get_form('forms_test_simple_form');