3 namespace Drupal\image\Form;
5 use Drupal\Core\Entity\EntityConfirmFormBase;
6 use Drupal\Core\Form\FormStateInterface;
9 * Form controller for image style flush.
11 class ImageStyleFlushForm extends EntityConfirmFormBase {
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()]);
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.');
30 public function getConfirmText() {
31 return $this->t('Flush');
37 public function getCancelUrl() {
38 return $this->entity->urlInfo('collection');
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());