public function FastlySettingsForm::purgeAllByKeys in Fastly 8.3
Purge all.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
\Drupal\Core\Ajax\AjaxResponse AjaxResponse.
File
- src/
Form/ FastlySettingsForm.php, line 448
Class
- FastlySettingsForm
- Class FastlySettingsForm Defines a form to configure module settings.
Namespace
Drupal\fastly\FormCode
public function purgeAllByKeys(array $form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$purge = $this->api
->purgeAll();
if (!$purge) {
$message = $this
->t("Something went wrong while purging / invalidating content. Please, check logs for more info.");
}
else {
$message = $this
->t("All site content is purged / invalidated successfully.");
}
$response
->addCommand(new HtmlCommand('.purge-all-message-keys', $message));
return $response;
}