You are here

public function GALoginTotpSetup::getOverview in Google Authenticator login 8

Plugin overview page.

Parameters

array $params: Parameters to setup the overview information.

Return value

array The overview form.

Overrides TfaSetupInterface::getOverview

File

src/Plugin/TfaSetup/GALoginTotpSetup.php, line 185

Class

GALoginTotpSetup
TOTP setup class to setup TOTP validation.

Namespace

Drupal\ga_login\Plugin\TfaSetup

Code

public function getOverview(array $params) {
  $plugin_text = $this
    ->t('Validation Plugin: @plugin', [
    '@plugin' => str_replace(' Setup', '', $this
      ->getLabel()),
  ]);
  $output = [
    'heading' => [
      '#type' => 'html_tag',
      '#tag' => 'h2',
      '#value' => $this
        ->t('TFA application'),
    ],
    'validation_plugin' => [
      '#type' => 'markup',
      '#markup' => '<p>' . $plugin_text . '</p>',
    ],
    'description' => [
      '#type' => 'html_tag',
      '#tag' => 'p',
      '#value' => $this
        ->t('Generate verification codes from a mobile or desktop application.'),
    ],
    'link' => [
      '#theme' => 'links',
      '#links' => [
        'admin' => [
          'title' => !$params['enabled'] ? $this
            ->t('Set up application') : $this
            ->t('Reset application'),
          'url' => Url::fromRoute('tfa.validation.setup', [
            'user' => $params['account']
              ->id(),
            'method' => $params['plugin_id'],
          ]),
        ],
      ],
    ],
  ];
  return $output;
}