You are here

public function InviteResendForm::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/InviteResendForm.php, line 100

Class

InviteResendForm
Class InviteResendForm.

Namespace

Drupal\invite\Form

Code

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

  /** @var \Drupal\invite\InviteInterface $invite */
  $invite = $this->inviteStorage;
  $invite_by_email = new InviteByEmail([], 0, 0, $this->messenger);
  $invite_by_email
    ->send($invite);

  // Set invite status to active, if it was withdrawn or any other status.
  $invite
    ->set('status', InviteConstants::INVITE_VALID);
  $invite
    ->save();
  $url = Url::fromRoute('invite.invite_list');
  $form_state
    ->setRedirectUrl($url);
}