You are here

protected function EmailConfirmerResponseForm::cancelConfirmation in Email confirmer 8

Cancels the email confirmation.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

Throws

\Drupal\email_confirmer\InvalidConfirmationStateException If confirmation is expired, confirmed or already cancelled.

1 call to EmailConfirmerResponseForm::cancelConfirmation()
EmailConfirmerResponseForm::submitForm in src/Form/EmailConfirmerResponseForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…

File

src/Form/EmailConfirmerResponseForm.php, line 156

Class

EmailConfirmerResponseForm
Email confirmation response form.

Namespace

Drupal\email_confirmer\Form

Code

protected function cancelConfirmation(FormStateInterface $form_state) {

  /** @var \Drupal\email_confirmer\EmailConfirmationInterface $confirmation */
  $confirmation = $this
    ->getEntity();
  $confirmation
    ->cancel();
  $this
    ->messenger()
    ->addStatus($this
    ->t('Email confirmation cancelled.'));
  $confirmation
    ->save();
  $form_state
    ->setRedirectUrl($this
    ->getRedirectUrl('cancel'));
}