You are here

function hook_tfa_api in Two-factor Authentication (TFA) 7.2

Same name and namespace in other branches
  1. 6 tfa.api.php \hook_tfa_api()
  2. 7 tfa.api.php \hook_tfa_api()

Define TFA plugins.

This hook is required to use your own TFA plugin.

A plugin must extend the TfaBasePlugin class and may implement one or more TFA plugin interfaces.

Note, user-defined plugin classes must be available to the Drupal registry for loading. Either define them in a .info file or via an autoloader.

Return value

array Keyed array of information about the plugin for TFA integration.

Required key:

  • 'example_machine_name' A unique machine name identifying the plugin.

With required sub-array containing:

  • 'name' Human-readable name of the plugin.
  • 'class' Class name of the plugin.

Optional sub-elements:

  • 'callback' Function name to call to return this plugin's object.
1 function implements hook_tfa_api()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

tfa_test_tfa_api in tests/tfa_test.module
Implements hook_tfa_api().
3 invocations of hook_tfa_api()
tfa_admin_settings in ./tfa.admin.inc
Admin settings form.
tfa_get_plugin in ./tfa.module
Get or create a TFA plugin object.
tfa_start_context in ./tfa.module
Start context for TFA.

File

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

Code

function hook_tfa_api() {
  return array(
    'my_tfa_plugin' => array(
      'name' => 'My TFA plugin',
      'class' => 'MyTfaPlugin',
    ),
  );
}