You are here

protected function Element::componentEditForm in Form Builder 7.2

Generate the component edit form for this component.

Return value

array Form-API array of the component edit form.

1 call to Element::componentEditForm()
Element::configurationForm in modules/webform/src/Element.php
Get the configuration form for this element.

File

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

Class

Element

Namespace

Drupal\form_builder_webform

Code

protected function componentEditForm($component) {
  $component = $this->element['#webform_component'];
  $form_id = 'webform_component_edit_form';
  $form_state = form_state_defaults();
  $nid = isset($component['nid']) ? $component['nid'] : NULL;
  $node = !isset($nid) ? (object) array(
    'nid' => NULL,
    'webform' => webform_node_defaults(),
  ) : node_load($nid);

  // The full node is needed here so that the "private" option can be access
  // checked.
  $form = $form_id([], $form_state, $node, $component);

  // We want to avoid a full drupal_get_form() for now but some alter hooks
  // need defaults normally set in drupal_prepare_form().
  $form += [
    '#submit' => [],
  ];
  $form_state['build_info']['args'][1] = $component;
  drupal_alter([
    'form',
    'form_webform_component_edit_form',
  ], $form, $form_state, $form_id);
  return $form;
}