public function FormBase::preview in Form Builder 7.2
Build form-tree from element objects.
File
- src/
FormBase.php, line 413
Class
Namespace
Drupal\form_builderCode
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;
}