You are here

function _formdefaults_addon_fields in Form Defaults 6.2

Same name and namespace in other branches
  1. 8 formdefaults.module \_formdefaults_addon_fields()
  2. 5.3 formdefaults.module \_formdefaults_addon_fields()
  3. 7 formdefaults.module \_formdefaults_addon_fields()
1 call to _formdefaults_addon_fields()
formdefaults_form_alter in ./formdefaults.module
implements hook_form_alter

File

./formdefaults.module, line 91

Code

function _formdefaults_addon_fields($form_def, &$form) {

  // Add a header and a footer to all forms for instructions
  if ($form_def['formdefaults_header']) {
    $form['formdefaults_header'] = array(
      '#type' => 'markup',
      '#value' => '',
      '#weight' => -50,
    );
  }
  if ($form_def['formdefaults_footer']) {
    $form['formdefaults_footer'] = array(
      '#type' => 'markup',
      '#value' => '',
      '#weight' => 50,
    );
  }

  // add on arbitrary fields created by the form editor.
  foreach ((array) $form_def['#formdefaults_addon_fields'] as $key => $field) {
    $form[$key] = $field;
  }
}