You are here

function form_builder_pre_render in Form Builder 6

Same name and namespace in other branches
  1. 7.2 includes/form_builder.admin.inc \form_builder_pre_render()
  2. 7 includes/form_builder.admin.inc \form_builder_pre_render()

Take a form structure and add a prebuild function to every element.

1 string reference to 'form_builder_pre_render'
form_builder_preview_prepare in includes/form_builder.admin.inc
Before editing a form, modify it slightly to add functionality used in the preview and disable use of the actual form fields in any way.

File

includes/form_builder.admin.inc, line 497
form_builder.admin.inc Administrative interface for editing forms.

Code

function form_builder_pre_render($element) {
  $element['#form_builder_wrappers'][] = 'form_builder_element_wrapper';
  $element['#post_render'][] = 'form_builder_wrappers';
  if ($element['#form_builder']['element_type'] == 'fieldset') {
    $element['#attributes']['class'] = isset($element['#attributes']['class']) ? $element['#attributes']['class'] . ' form-builder-fieldset' : 'form-builder-fieldset';
  }
  if (isset($element['#type']) && $element['#type'] == 'fieldset' && count(element_children($element)) == 0) {
    $element['#children'] = theme('form_builder_empty_fieldset');
  }

  // Allow modules to make modifications to this element.
  drupal_alter('form_builder_preview', $element, $element['#form_builder']['form_type'], $element['#form_builder']['form_id']);
  return $element;
}