2823fe80fada27c9968847e5b271ca59c922799b
[yaffs-website] / web / modules / contrib / fontyourface / modules / local_fonts / src / Form / LocalFontConfigEntityDeleteForm.php
1 <?php
2
3 namespace Drupal\local_fonts\Form;
4
5 use Drupal\Core\Entity\EntityConfirmFormBase;
6 use Drupal\Core\Form\FormStateInterface;
7 use Drupal\Core\Url;
8
9 /**
10  * Builds the form to delete Custom Font entities.
11  */
12 class LocalFontConfigEntityDeleteForm extends EntityConfirmFormBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public function getQuestion() {
18     return $this->t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]);
19   }
20
21   /**
22    * {@inheritdoc}
23    */
24   public function getCancelUrl() {
25     return new Url('entity.local_font_config_entity.collection');
26   }
27
28   /**
29    * {@inheritdoc}
30    */
31   public function getConfirmText() {
32     return $this->t('Delete');
33   }
34
35   /**
36    * {@inheritdoc}
37    */
38   public function submitForm(array &$form, FormStateInterface $form_state) {
39     $this->entity->delete();
40
41     drupal_set_message(
42       $this->t('content @type: deleted @label.',
43         [
44           '@type' => $this->entity->bundle(),
45           '@label' => $this->entity->label(),
46         ]
47         )
48     );
49
50     $form_state->setRedirectUrl($this->getCancelUrl());
51   }
52
53 }