You are here

public function ClearUrlForm::submitForm in Akamai 8.3

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/ClearUrlForm.php, line 74

Class

ClearUrlForm
Builds a form to clear urls.

Namespace

Drupal\akamai\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $uri_to_purge = $form_state
    ->getValues()['path'];
  \Drupal::service('akamai.client.factory')
    ->get()
    ->purgeUrl($uri_to_purge);
  $this->messenger
    ->addMessage($this
    ->t('Asked Akamai to purge :uri', [
    ':uri' => $uri_to_purge,
  ]));
}