You are here

public function WSFieldConfigForm::buildForm in Web Service Data 2.0.x

Same name and namespace in other branches
  1. 8 modules/wsdata_field/src/Form/WSFieldConfigForm.php \Drupal\wsdata_field\Form\WSFieldConfigForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides EntityForm::buildForm

File

modules/wsdata_field/src/Form/WSFieldConfigForm.php, line 66

Class

WSFieldConfigForm
Class WSFieldsConfigForm.

Namespace

Drupal\wsdata_field\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $field_config = NULL) {
  if ($field_config) {
    $field = FieldConfig::load($field_config);
    $form_state
      ->set('field_config', $field);
    $form_state
      ->set('entity_type_id', $field
      ->getTargetEntityTypeId());
    $form_state
      ->set('bundle', $field
      ->getTargetBundle());
  }
  return parent::buildForm($form, $form_state);
}