You are here

public function TfaBasicSms::getForm in TFA Basic plugins 7

Get TFA process form from plugin.

Parameters

array $form: The form array structure.

array $form_state: The current form state array.

Return value

array Form API array.

Overrides TfaValidationPluginInterface::getForm

File

includes/tfa_sms.inc, line 41

Class

TfaBasicSms

Code

public function getForm(array $form, array &$form_state) {
  $form['code'] = array(
    '#type' => 'textfield',
    '#title' => t('Verification Code'),
    '#required' => TRUE,
    '#description' => t('Enter @length-character code sent to your device.', array(
      '@length' => $this->codeLength,
    )),
  );
  if (module_exists('elements')) {
    $form['code']['#type'] = 'numberfield';
  }
  $form['actions']['#type'] = 'actions';

  // @todo optionally report on when code was sent/delivered.
  $form['actions']['login'] = array(
    '#type' => 'submit',
    '#value' => t('Verify'),
  );
  $form['actions']['resend'] = array(
    '#type' => 'submit',
    '#value' => t('Resend'),
    '#submit' => array(
      'tfa_form_submit',
    ),
    '#limit_validation_errors' => array(),
  );
  return $form;
}