You are here

public function FormBuilderFormBase::preview in Form Builder 7

Build form-tree from element objects.

File

./form_builder.classes.inc, line 731

Class

FormBuilderFormBase

Code

public function preview() {
  $form = array();
  $elements = array(
    FORM_BUILDER_ROOT => &$form,
  );
  foreach ($this
    ->getElementsInPreOrder() as $id => $e) {
    $elements[$id] = $e
      ->render();
    $elements[$e
      ->parentId()][$e
      ->key()] =& $elements[$id];
  }
  $form['#tree'] = TRUE;
  $form['#form_builder'] = array(
    'form_type' => $this->formType,
    'form_id' => $this->formId,
    'sid' => $this->sid,
  );
  return $form;
}