You are here

function hook_form_builder_types in Form Builder 6

Define the fields and properties supported by a form type.

All modules that wish to create an configurable form need implement this hook. It defines to Form Builder what types of fields the implementing module knows how to modify. Within each field that is modifiable, the properties that may be changed are also listed.

Return value

An array of form types that this module may edit. Within each form type, a list of fields that can be edited. Each field contains the following properties:

  • title: The name of the field type that is displayed in the new fields block.
  • properties: An array of properties that are configurable. Configuration of these properties is defined by hook_form_builder_properties().
  • default: A complete sample form element that will be used when a new element of this type is added to the form. Further modification of this default element may be done in hook_form_builder_element_alter().
2 functions implement hook_form_builder_types()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

form_builder_examples_form_builder_types in examples/form_builder_examples.module
Implementation of hook_form_builder_types().
form_builder_webform_form_builder_types in modules/webform/form_builder_webform.module
Implements hook_form_builder_types().
2 invocations of hook_form_builder_types()
form_builder_get_form_type in includes/form_builder.api.inc
Get a list of all properties that are supported by a particular form type.
form_builder_requirements in ./form_builder.install
Implementation of hook_requirements().

File

./form_builder.api.php, line 33
These are the hooks that are invoked by Form Builder.

Code

function hook_form_builder_types() {
  $fields = array();

  // The #type property of the field is used as the key.
  $fields['textfield'] = array(
    'title' => t('Textfield'),
    // Properties that may be edited on this field type.
    'properties' => array(
      'title',
      'description',
      'field_prefix',
      'field_suffix',
      'default_value',
      'required',
      'size',
    ),
    // A complete default form element used when a new field of this type
    // is added to a form.
    'default' => array(
      '#title' => t('New textfield'),
      '#type' => 'textfield',
    ),
  );

  // Return the array of supported fields, with a key for the form type that
  // these fields apply to.
  return array(
    'node' => $fields,
  );
}