c6e82949fd7e0e7d125aff913c36aee32d4c381a
[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 class FilterDisableForm extends EntityConfirmFormBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public function getQuestion() {
18     return $this->t('Are you sure you want to disable the text format %format?', ['%format' => $this->entity->label()]);
19   }
20
21   /**
22    * {@inheritdoc}
23    */
24   public function getCancelUrl() {
25     return new Url('filter.admin_overview');
26   }
27
28   /**
29    * {@inheritdoc}
30    */
31   public function getConfirmText() {
32     return $this->t('Disable');
33   }
34
35   /**
36    * {@inheritdoc}
37    */
38   public function getDescription() {
39     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.');
40   }
41
42   /**
43    * {@inheritdoc}
44    */
45   public function submitForm(array &$form, FormStateInterface $form_state) {
46     $this->entity->disable()->save();
47     drupal_set_message($this->t('Disabled text format %format.', ['%format' => $this->entity->label()]));
48
49     $form_state->setRedirectUrl($this->getCancelUrl());
50   }
51
52 }