You are here

public function FlushExternalImages::submitForm in Imagecache External 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/FlushExternalImages.php, line 74

Class

FlushExternalImages
Defines a confirmation form for deleting mymodule data.

Namespace

Drupal\imagecache_external\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  if (imagecache_external_flush_cache()) {
    $this
      ->messenger()
      ->addMessage(t('Flushed external images'));
  }
  else {
    $this
      ->messenger()
      ->addMessage(t('Could not flush external images'), MessengerInterface::TYPE_ERROR);
  }
  $form_state
    ->setRedirect('imagecache_external.admin_settings');
}