You are here

public function InviteWithdrawForm::submitForm in Invite 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/InviteWithdrawForm.php, line 99

Class

InviteWithdrawForm
Class InviteWithdrawForm.

Namespace

Drupal\invite\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  /** @var \Drupal\invite\InviteInterface $invite */
  $invite = $this->inviteStorage;
  $invite
    ->setStatus(InviteConstants::INVITE_WITHDRAWN);
  $invite
    ->save();
  $this->messenger
    ->addStatus($this
    ->t('The invitation has been withdrawn'));
  $url = Url::fromRoute('invite.invite_list');
  $form_state
    ->setRedirectUrl($url);
}