You are here

public function CacheControlForm::submitForm in Akamai 8

Same name and namespace in other branches
  1. 8.3 src/Form/CacheControlForm.php \Drupal\akamai\Form\CacheControlForm::submitForm()
  2. 8.2 src/Form/CacheControlForm.php \Drupal\akamai\Form\CacheControlForm::submitForm()

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

lib/Drupal/akamai/Form/CacheControlForm.php, line 86
Contains \Drupal\akamai\Form\CacheControlForm.

Class

CacheControlForm
Defines a form that configures Akamai settings.

Namespace

Drupal\akamai\Form

Code

public function submitForm(array &$form, array &$form_state) {
  $paths = explode("\n", filter_xss($form_state['values']['paths']));
  $action = $form_state['values']['refresh'];
  $overrides = array(
    'action' => $form_state['values']['refresh'],
    'domain' => $form_state['values']['domain_override'],
    'email' => $form_state['values']['email'],
  );
  $did_clear = akamai_clear_url($paths, $overrides);
  if ($did_clear) {
    $message = t("Akamai Cache Request has been made successfully, please allow 10 minutes for changes to take effect.") . theme("item_list", $paths);
    drupal_set_message($message);
  }
  else {
    drupal_set_message(t("There was a problem with your cache control request.  Check your log messages for more information."), 'error');
  }
}