Same filename and directory in other branches
- 8.9.x core/modules/image/src/Form/ImageStyleFlushForm.php
- 9 core/modules/image/src/Form/ImageStyleFlushForm.php
Namespace
Drupal\image\Form
File
core/modules/image/src/Form/ImageStyleFlushForm.php
View source
<?php
namespace Drupal\image\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
class ImageStyleFlushForm extends EntityConfirmFormBase {
public function getQuestion() {
return $this
->t('Are you sure you want to apply the updated %name image effect to all images?', [
'%name' => $this->entity
->label(),
]);
}
public function getDescription() {
return $this
->t('This operation does not change the original images but the copies created for this style will be recreated.');
}
public function getConfirmText() {
return $this
->t('Flush');
}
public function getCancelUrl() {
return $this->entity
->toUrl('collection');
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity
->flush();
$this
->messenger()
->addStatus($this
->t('The image style %name has been flushed.', [
'%name' => $this->entity
->label(),
]));
$form_state
->setRedirectUrl($this
->getCancelUrl());
}
}
Classes