You are here

public function FieldGroupAddForm::buildConfigurationForm in Field Group 8.3

Same name and namespace in other branches
  1. 8 src/Form/FieldGroupAddForm.php \Drupal\field_group\Form\FieldGroupAddForm::buildConfigurationForm()

Build the formatter configuration form.

1 call to FieldGroupAddForm::buildConfigurationForm()
FieldGroupAddForm::buildForm in src/Form/FieldGroupAddForm.php
Form constructor.

File

src/Form/FieldGroupAddForm.php, line 207

Class

FieldGroupAddForm
Provides a form for adding a fieldgroup to a bundle.

Namespace

Drupal\field_group\Form

Code

public function buildConfigurationForm(array &$form, FormStateInterface $form_state) {
  $group = new \stdClass();
  $group->context = $this->context;
  $group->entity_type = $this->entityTypeId;
  $group->bundle = $this->bundle;
  $group->mode = $this->mode;
  $manager = $this->fieldGroupFormatterPluginManager;
  $plugin = $manager
    ->getInstance([
    'format_type' => $form_state
      ->getValue('group_formatter'),
    'configuration' => [
      'label' => $form_state
        ->getValue('label'),
    ],
    'group' => $group,
  ]);
  $form['format_settings'] = [
    '#type' => 'container',
    '#tree' => TRUE,
  ];
  $form['format_settings'] += $plugin
    ->settingsForm();
  $form['actions'] = [
    '#type' => 'actions',
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Create group'),
    '#button_type' => 'primary',
  ];
}