a8a2ba3aad44600b6a819947c8848da27f75e17a
[yaffs-website] / web / core / modules / filter / src / Form / FilterDisableForm.php
1 <?php
2
3 namespace Drupal\filter\Form;
4
5 use Drupal\Core\Entity\EntityConfirmFormBase;
6 use Drupal\Core\Form\FormStateInterface;
7 use Drupal\Core\Url;
8
9 /**
10  * Provides the filter format disable form.
11  *
12  * @internal
13  */
14 class FilterDisableForm extends EntityConfirmFormBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public function getQuestion() {
20     return $this->t('Are you sure you want to disable the text format %format?', ['%format' => $this->entity->label()]);
21   }
22
23   /**
24    * {@inheritdoc}
25    */
26   public function getCancelUrl() {
27     return new Url('filter.admin_overview');
28   }
29
30   /**
31    * {@inheritdoc}
32    */
33   public function getConfirmText() {
34     return $this->t('Disable');
35   }
36
37   /**
38    * {@inheritdoc}
39    */
40   public function getDescription() {
41     return $this->t('Disabled text formats are completely removed from the administrative interface, and any content stored with that format will not be displayed. This action cannot be undone.');
42   }
43
44   /**
45    * {@inheritdoc}
46    */
47   public function submitForm(array &$form, FormStateInterface $form_state) {
48     $this->entity->disable()->save();
49     drupal_set_message($this->t('Disabled text format %format.', ['%format' => $this->entity->label()]));
50
51     $form_state->setRedirectUrl($this->getCancelUrl());
52   }
53
54 }