You are here

SkinDeleteForm.php in Skinr 8.2

File

skinr_ui/src/Form/SkinDeleteForm.php
View source
<?php

/**
 * @file
 * Contains \Drupal\skinr_ui\Form\SkinDeleteForm.
 */
namespace Drupal\skinr_ui\Form;

use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;

/**
 * Provides a deletion confirmation form for the skin instance deletion form.
 */
class SkinDeleteForm extends EntityConfirmFormBase {

  /**
   * {@inheritdoc}
   */
  public function getQuestion() {
    return $this
      ->t('Are you sure you want to delete skin %name?', array(
      '%name' => $this->entity
        ->label(),
    ));
  }

  /**
   * {@inheritdoc}
   */
  public function getCancelUrl() {
    return new Url('skinr_ui.list');
  }

  /**
   * {@inheritdoc}
   */
  public function getConfirmText() {
    return $this
      ->t('Delete');
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->entity
      ->delete();
    drupal_set_message($this
      ->t('Skin %name has been removed.', array(
      '%name' => $this->entity
        ->label(),
    )));
    $form_state
      ->setRedirectUrl($this
      ->getCancelUrl());
  }

}

Classes

Namesort descending Description
SkinDeleteForm Provides a deletion confirmation form for the skin instance deletion form.