You are here

function _formdefaults_addon_fields in Form Defaults 5.3

Same name and namespace in other branches
  1. 8 formdefaults.module \_formdefaults_addon_fields()
  2. 6.2 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 92

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' => -10,
    );
  }
  if ($form_def['formdefaults_footer']) {
    $form['formdefaults_footer'] = array(
      '#type' => 'markup',
      '#value' => '',
      '#weight' => 10,
    );
  }

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