You are here

PetDeleteForm.php in Previewable email templates 8.3

Same filename and directory in other branches
  1. 8.4 src/Form/PetDeleteForm.php
  2. 8 src/Form/PetDeleteForm.php

Namespace

Drupal\pet\Form

File

src/Form/PetDeleteForm.php
View source
<?php

namespace Drupal\pet\Form;

use Drupal\Core\Entity\ContentEntityDeleteForm;
use Drupal\Core\Form\FormStateInterface;

/**
 * Provides a form for deleting Pet entities.
 *
 * @ingroup pet
 */
class PetDeleteForm extends ContentEntityDeleteForm {

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->entity
      ->delete();
    $this
      ->logger('pet')
      ->notice('@type: deleted %title.', [
      '@type' => $this->entity
        ->bundle(),
      '%title' => $this->entity
        ->label(),
    ]);
    drupal_set_message(t('@type %title has been deleted.', [
      '@type' => $this->entity
        ->bundle(),
      '%title' => $this->entity
        ->label(),
    ]));
    $form_state
      ->setRedirect('entity.pet.collection');
  }

}

Classes

Namesort descending Description
PetDeleteForm Provides a form for deleting Pet entities.