You are here

function form_builder_pre_render in Form Builder 7

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

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

2 string references to 'form_builder_pre_render'
FormBuilderElementBase::addPreRender in ./form_builder.classes.inc
Add our pre-render function to the element-array.
FormBuilderWebformFormTest::testPreview in modules/webform/tests/FormBuilderWebformFormTest.php

File

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

Code

function form_builder_pre_render($element) {
  $element['#theme_wrappers'][] = 'form_builder_element_wrapper';
  if ($element['#form_builder']['element_type'] == 'fieldset') {
    $element['#attributes']['class'][] = '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;
}