You are here

public function MoAuthSupport::buildForm in Google Authenticator / 2 Factor Authentication - 2FA 8

Same name and namespace in other branches
  1. 8.2 src/Form/MoAuthSupport.php \Drupal\miniorange_2fa\Form\MoAuthSupport::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

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

Class

MoAuthSupport
Showing Support form info.

Namespace

Drupal\miniorange_2fa\Form

Code

public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state) {
  $form['markup_library'] = array(
    '#attached' => array(
      'library' => array(
        "miniorange_2fa/miniorange_2fa.license",
      ),
    ),
  );
  $form['markup_1'] = array(
    '#markup' => '<div class="mo_saml_table_layout_1"><div class="mo_saml_table_layout mo_saml_container">
                        <h3>New 2FA method request</h3><div>Need new 2FA method? Just send us a requirement so we can help you.<br /><br /></div>',
  );
  $email = '';
  $phone = '';
  if (MoAuthUtilities::isCustomerRegistered()) {
    $customer = new MiniorangeCustomerProfile();
    $email = $customer
      ->getRegisteredEmail();
    $phone = $customer
      ->getRegisteredPhone();
  }
  $form['mo_auth_email_address'] = array(
    '#type' => 'textfield',
    '#title' => t('Email Address'),
    '#default_value' => $email,
    '#attributes' => array(
      'placeholder' => 'Enter your email',
      'class' => array(
        'mo_auth_new_2fa',
      ),
    ),
    '#required' => TRUE,
  );
  $form['mo_auth_phone_number'] = array(
    '#type' => 'textfield',
    '#title' => t('Phone number'),
    '#default_value' => $phone,
    '#id' => 'query_phone',
    '#description' => 'Enter number with country code Eg. +00xxxxxxxxxx',
    '#attributes' => array(
      'class' => array(
        'query_phone',
        'mo_auth_new_2fa',
      ),
      'placeholder' => 'Enter number with country code Eg. +00xxxxxxxxxx',
    ),
  );
  $form['mo_auth_support_query'] = array(
    '#type' => 'textarea',
    '#id' => "mo_auth_new_2fa_text_area",
    '#title' => t('Description'),
    '#cols' => 5,
    '#rows' => 5,
    '#attributes' => array(
      'placeholder' => 'Describe your requirement here!',
      'class' => array(
        'mo_auth_new_2fa',
      ),
    ),
    '#required' => TRUE,
    '#suffix' => '<br>',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  $form['markup_support_1'] = array(
    '#markup' => '<br><br><br><br></div><div class="mo_saml_table_layout_support_1 mo_saml_container" id="ma_saml_support_query">
                <h3><b>Know more about module:</b></h3><div>Need any help? We can help you with configuring miniOrange 2FA module on your site. Just send us a query and we will get back to you soon.<br /></div><br>',
  );
  $form['markup_support_2'] = array(
    '#markup' => '<div>Click <a target="_blank" href="https://plugins.miniorange.com/drupal-two-factor-authentication-2fa">here</a> to know more about Drupal 8 2FA module.<br>
                          Click <a target="_blank" href="https://plugins.miniorange.com/drupal-2-factor-authentication-google-authentication">here</a> to see setup guide for Drupal 8 2FA module.<br><br>
                          Click <a target="_blank" href="https://plugins.miniorange.com/drupal">here</a> to see all other security related products which we provide for drupal.<br>
                          </div><br><br>',
  );
  MoAuthUtilities::faq($form, $form_state);
  $form['miniorange_markup_end'] = array(
    '#markup' => '</div></div>',
  );
  return $form;
}