"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.9/core/modules/filter/src/Form/FilterDisableForm.php" (18 Nov 2020, 1281 Bytes) of package /linux/www/drupal-8.9.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "FilterDisableForm.php" see the Fossies "Dox" file reference documentation.

    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     $this->messenger()->addStatus($this->t('Disabled text format %format.', ['%format' => $this->entity->label()]));
   50 
   51     $form_state->setRedirectUrl($this->getCancelUrl());
   52   }
   53 
   54 }