You are here

public function FieldGroupDeleteForm::submitForm in Field Group 8

Same name and namespace in other branches
  1. 8.3 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 48

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 = entity_get_bundles();
  $bundle_label = $bundles[$this->fieldGroup->entity_type][$this->fieldGroup->bundle]['label'];
  field_group_group_delete($this->fieldGroup);
  drupal_set_message(t('The group %group has been deleted from the %type content type.', array(
    '%group' => t($this->fieldGroup->label),
    '%type' => $bundle_label,
  )));

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