You are here

public function SlideGroupDeleteForm::submitForm in Drupal Slider 8.2

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

Function submitForm.

Overrides EntityForm::submitForm

File

src/Form/SlideGroupDeleteForm.php, line 40

Class

SlideGroupDeleteForm
Class SlideGroupDeleteForm.

Namespace

Drupal\drupal_slider\Form

Code

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

  // Delete the entity.
  $this->entity
    ->delete();

  // Set a message that the entity was deleted.
  $this
    ->messenger()
    ->addMessage($this
    ->t('Slide group %label was deleted.', [
    '%label' => $this->entity
      ->label(),
  ]));

  // Redirect the user to the list controller when complete.
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}