You are here

public function FieldGroupDeleteForm::submitForm in Field Group 8.3

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

Form submission handler.

Parameters

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

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

Overrides FormInterface::submitForm

File

src/Form/FieldGroupDeleteForm.php, line 91

Class

FieldGroupDeleteForm
Provides a form for removing a fieldgroup from a bundle.

Namespace

Drupal\field_group\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $bundles = $this->entityTypeBundleInfo
    ->getAllBundleInfo();
  $bundle_label = $bundles[$this->fieldGroup->entity_type][$this->fieldGroup->bundle]['label'];
  field_group_delete_field_group($this->fieldGroup);
  $this->messenger
    ->addMessage($this
    ->t('The group %group has been deleted from the %type content type.', [
    '%group' => $this->fieldGroup->label,
    '%type' => $bundle_label,
  ]));

  // Redirect.
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}