You are here

public function GroupContentTypeDeleteForm::submitForm in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Form/GroupContentTypeDeleteForm.php \Drupal\group\Entity\Form\GroupContentTypeDeleteForm::submitForm()

Overrides EntityDeleteFormTrait::submitForm

File

src/Entity/Form/GroupContentTypeDeleteForm.php, line 84

Class

GroupContentTypeDeleteForm
Provides a form for group content type deletion.

Namespace

Drupal\group\Entity\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  /** @var \Drupal\group\Entity\GroupContentTypeInterface $group_content_type */
  $group_content_type = $this
    ->getEntity();
  $group_type = $group_content_type
    ->getGroupType();
  $plugin = $group_content_type
    ->getContentPlugin();
  $group_content_type
    ->delete();
  \Drupal::logger('group_content_type')
    ->notice('Uninstalled %plugin from %group_type.', [
    '%plugin' => $plugin
      ->getLabel(),
    '%group_type' => $group_type
      ->label(),
  ]);
  $form_state
    ->setRedirect('entity.group_type.content_plugins', [
    'group_type' => $group_type
      ->id(),
  ]);
  $this
    ->messenger()
    ->addStatus($this
    ->t('The content plugin was uninstalled from the group type.'));
}