You are here

function form_builder_pre_render in Form Builder 7.2

Same name and namespace in other branches
  1. 6 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.

2 string references to 'form_builder_pre_render'
ElementBase::addPreRender in src/ElementBase.php
Add our pre-render function to the element-array.
FormTest::testPreview in modules/webform/tests/FormTest.php
Test the form builder preview.

File

includes/form_builder.admin.inc, line 524
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;
}