You are here

public function EnrollInviteUserForm::submitForm in Open Social 8.9

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_event/modules/social_event_invite/src/Form/EnrollInviteUserForm.php \Drupal\social_event_invite\Form\EnrollInviteUserForm::submitForm()
  2. 10.0.x modules/social_features/social_event/modules/social_event_invite/src/Form/EnrollInviteUserForm.php \Drupal\social_event_invite\Form\EnrollInviteUserForm::submitForm()
  3. 10.1.x modules/social_features/social_event/modules/social_event_invite/src/Form/EnrollInviteUserForm.php \Drupal\social_event_invite\Form\EnrollInviteUserForm::submitForm()
  4. 10.2.x modules/social_features/social_event/modules/social_event_invite/src/Form/EnrollInviteUserForm.php \Drupal\social_event_invite\Form\EnrollInviteUserForm::submitForm()

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 InviteUserBaseForm::submitForm

File

modules/social_features/social_event/modules/social_event_invite/src/Form/EnrollInviteUserForm.php, line 119

Class

EnrollInviteUserForm
Class EnrollInviteForm.

Namespace

Drupal\social_event_invite\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $params['recipients'] = $form_state
    ->getValue('entity_id_new');
  $params['nid'] = $form_state
    ->getValue('event');
  $tempstore = $this->tempStoreFactory
    ->get('event_invite_form_values');
  try {
    $tempstore
      ->set('params', $params);
    $form_state
      ->setRedirect('social_event_invite.confirm_invite', [
      'node' => $form_state
        ->getValue('event'),
    ]);
  } catch (\Exception $error) {
    $this->loggerFactory
      ->get('event_invite_form_values')
      ->alert(t('@err', [
      '@err' => $error,
    ]));
    $this->messenger
      ->addWarning(t('Unable to proceed, please try again.'));
  }
}