You are here

public function MoAuthSupport::submitForm in Google Authenticator / 2 Factor Authentication - 2FA 8.2

Same name and namespace in other branches
  1. 8 src/Form/MoAuthSupport.php \Drupal\miniorange_2fa\Form\MoAuthSupport::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 FormInterface::submitForm

File

src/Form/MoAuthSupport.php, line 222
Contains support form for miniOrange 2FA Login Module.

Class

MoAuthSupport
Showing Support form info.

Namespace

Drupal\miniorange_2fa\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_values = $form_state
    ->getValues();
  $email = '';
  $phone = '';
  $query = '';
  $query_type = '';
  if ($form_values['mo_auth_vertical_tabs__active_tab'] === 'edit-miniorange-support') {
    $email = $form_values['mo_auth_support_email_address'];
    $phone = $form_values['mo_auth_support_phone_number'];
    $query = $form_values['mo_auth_support_query'];
    $query_type = 'Support';
  }
  elseif ($form_values['mo_auth_vertical_tabs__active_tab'] === 'edit-miniorange-demo-request') {
    $email = $form_values['mo_auth_demo_email_address'];
    $phone = $form_values['mo_auth_demo_plan'];
    $query = $form_values['mo_auth_demo_description'];
    $query_type = 'Demo Request';
  }
  elseif ($form_values['mo_auth_vertical_tabs__active_tab'] === 'edit-miniorange-feature-request') {
    $email = $form_values['mo_auth_feature_email_address'];
    $phone = $form_values['mo_auth_feature_phone_number'];
    $query = $form_values['mo_auth_feature_query'];
    $query_type = 'New Feature Request';
  }
  MoAuthUtilities::send_support_query($email, $phone, $query, $query_type);
}