You are here

function hook_form_builder_load in Form Builder 7

Same name and namespace in other branches
  1. 6 form_builder.api.php \hook_form_builder_load()
  2. 7.2 form_builder.api.php \hook_form_builder_load()

Take a Form API array and save settings for changed elements.

Parameters

$form_type: The type of form being loaded.

$form_id: The unique identifier for the form being edited.

1 function implements hook_form_builder_load()

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_load in examples/form_builder_examples.module
Implementation of hook_form_builder_load().
1 invocation of hook_form_builder_load()
FormBuilderFormBase::loadFromStorage in ./form_builder.classes.inc

File

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

Code

function hook_form_builder_load($form_type, $form_id) {
  if ($form_type == 'node') {
    $node = (object) array(
      'type' => preg_replace('/_node_form/', '', $form_id),
    );

    // Load the form, usually by calling it's function directly.
    $form = node_form(array(), $node);

    // Allow other modules to extend the form.
    $form_state = array();
    drupal_alter('form', $form, $form_state, $form_id);

    // Loop through the form and add #form_builder properties to each element
    // that is configurable.
    foreach (element_children($form) as $key) {
      $form[$key]['#form_builder'] = array(
        'configurable' => TRUE,
        'removable' => TRUE,
      );
    }
    return $form;
  }
}