You are here

public function FlushSingleImageForm::submitForm in Flush Single Image Styles 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Form/FlushSingleImageForm.php, line 132

Class

FlushSingleImageForm
Class FlushSingleImageForm.

Namespace

Drupal\flush_single_image\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $paths = $this->flushSingleImage
    ->flush($form_state
    ->getValue('path'));
  foreach ($paths as $path) {
    $this->messenger
      ->addMessage(t('Flushed @path', [
      '@path' => $path,
    ]));
  }
  $this->messenger
    ->addMessage(t('Flushed all images for @path', [
    '@path' => $form_state
      ->getValue('path'),
  ]));
  $form_state
    ->setRebuild(TRUE);
}