You are here

function my_tfa_setup_form in Two-factor Authentication (TFA) 7.2

Form builder for account configuration of TFA plugin.

File

./tfa.api.php, line 69
TFA API.

Code

function my_tfa_setup_form($form, &$form_state, $account) {
  if (empty($form_state['storage'])) {

    // Include details about existing setup, if applicable.
    // Button to begin setup.
    $form['start'] = array(
      '#type' => 'submit',
      '#value' => t('Setup'),
    );
  }
  else {

    // Return the setup plugin's form.
    $tfa_setup = $form_state['storage']['tfa_setup'];
    $form = $tfa_setup
      ->getForm($form, $form_state);
  }

  // Required account element.
  $form['account'] = array(
    '#type' => 'value',
    '#value' => $account,
  );
  return $form;
}