public function ClearForm::submitForm in Mail Safety 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/ ClearForm.php, line 48
Class
- ClearForm
- Class ClearForm.
Namespace
Drupal\mail_safety\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Delete all emails stored by this module.
$mail_ids = array_keys(MailSafetyController::load());
foreach ($mail_ids as $mail_id) {
MailSafetyController::delete($mail_id);
}
// Return the user to the dashboard.
$form_state
->setRedirectUrl($this
->getCancelUrl());
}