You are here

public function Form::getComponent in Form Builder 7.2

Create a webform component array based the form_builder cache.

Parameters

string $element_id: Unique ID of the element.

Return value

array A webform component array.

1 call to Form::getComponent()
Form::getComponents in modules/webform/src/Form.php
Get a list of component-arrays just like in $node->webform['components'].

File

modules/webform/src/Form.php, line 92

Class

Form

Namespace

Drupal\form_builder_webform

Code

public function getComponent($element_id) {
  module_load_include('inc', 'form_builder_webform', 'form_builder_webform.components');
  $element = $this
    ->getElementArray($element_id);
  $component = $element['#webform_component'];
  $type = $component['type'];
  $component['email'] = 0;
  $component['nid'] = $this->formId;
  $component['weight'] = $element['#weight'];

  // The component can't decide this on it's own.
  $component['pid'] = 0;
  $component['form_builder_element_id'] = $element_id;

  // Allow each component to set any specific settings that can't be mapped.
  if ($saved_component = form_builder_webform_component_invoke($type, 'form_builder_save', $component, $element)) {
    $component = $saved_component;
  }
  return $component;
}