You are here

public function Element::render in Form Builder 7.2

(Re-)Render an element.

Return value

array New FAPI array reflecting all the changes made prior to callig this method.

Overrides ElementBase::render

File

modules/webform/src/Element.php, line 21

Class

Element

Namespace

Drupal\form_builder_webform

Code

public function render() {
  $element = $this->element;
  if (isset($element['#webform_component'])) {
    $component = $element['#webform_component'];
    $new_element = webform_component_invoke($component['type'], 'render', $component, NULL, FALSE);

    // Preserve the #weight. It may have been changed by the positions form.
    $new_element['#weight'] = $element['#weight'];
    $new_element['#key'] = $component['form_key'];
    $new_element['#webform_component'] = $component;
    $new_element['#form_builder'] = $element['#form_builder'];
    return $this
      ->addPreRender($new_element);
  }
  return $this
    ->addPreRender($element);
}