Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / image / src / Form / ImageStyleFlushForm.php
1 <?php
2
3 namespace Drupal\image\Form;
4
5 use Drupal\Core\Entity\EntityConfirmFormBase;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Form controller for image style flush.
10  */
11 class ImageStyleFlushForm extends EntityConfirmFormBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function getQuestion() {
17     return $this->t('Are you sure you want to apply the updated %name image effect to all images?', ['%name' => $this->entity->label()]);
18   }
19
20   /**
21    * {@inheritdoc}
22    */
23   public function getDescription() {
24     return $this->t('This operation does not change the original images but the copies created for this style will be recreated.');
25   }
26
27   /**
28    * {@inheritdoc}
29    */
30   public function getConfirmText() {
31     return $this->t('Flush');
32   }
33
34   /**
35    * {@inheritdoc}
36    */
37   public function getCancelUrl() {
38     return $this->entity->urlInfo('collection');
39   }
40
41   /**
42    * {@inheritdoc}
43    */
44   public function submitForm(array &$form, FormStateInterface $form_state) {
45     $this->entity->flush();
46     drupal_set_message($this->t('The image style %name has been flushed.', ['%name' => $this->entity->label()]));
47     $form_state->setRedirectUrl($this->getCancelUrl());
48   }
49
50 }