You are here

public function ApplyForRoleConfirmActionForm::submitForm in Apply for role 8

Form submission handler

Overrides FormInterface::submitForm

File

src/Form/ApplyForRoleConfirmActionForm.php, line 123

Class

ApplyForRoleConfirmActionForm

Namespace

Drupal\apply_for_role\Form

Code

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

  // If the form is valid and submitted, either approve or deny the application based on where the form came from.
  if ($this->form_action == 'approve') {
    $this->application_manager
      ->approve_application($this->application);
    $form_state
      ->setRedirect('apply_for_role.applications_listing');
  }
  else {
    $this->application_manager
      ->deny_application($this->application);
    $form_state
      ->setRedirect('apply_for_role.applications_listing');
  }
}