You are here

protected function BasicSetup::findPlugin in Two-factor Authentication (TFA) 8

Find the correct plugin that is being setup.

Parameters

string $plugin_id: Plugin ID.

Return value

array|null Plugin definitions.

Throws

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 call to BasicSetup::findPlugin()
BasicSetup::buildForm in src/Form/BasicSetup.php
Form constructor.

File

src/Form/BasicSetup.php, line 151

Class

BasicSetup
TFA setup form router.

Namespace

Drupal\tfa\Form

Code

protected function findPlugin($plugin_id) {
  $plugin = $this->tfaValidation
    ->getDefinition($plugin_id, FALSE);
  if (empty($plugin)) {
    $plugin = $this->tfaLogin
      ->getDefinition($plugin_id, FALSE);
  }
  if (empty($plugin)) {
    $plugin = $this->tfaSend
      ->getDefinition($plugin_id, FALSE);
  }
  if (empty($plugin)) {
    throw new PluginNotFoundException($plugin_id, sprintf('The "%s" plugin does not exist.', $plugin_id));
  }
  return $plugin;
}