You are here

function hook_connector in Connector 6

Same name and namespace in other branches
  1. 7 connector.api.php \hook_connector()

Define Connector support and options.

This hook enables modules to register Connector support.

Return value

An array of connectors that the module defines. Each connector's key should be a machine name for that connector. Each connector should contain an associative array that may contain the following key-value pairs, defining the connector:

  • "id callback": Required. A function that returns the external id of a connected user.
  • "button callback": A function returning an array defining a button for one-click login.
  • "connect button callback": A function returning an array defining a button for one-click connect.
  • "logout callback": A function...
  • "information callback": A function...
  • "avatar callback": A function...
  • "delete callback": A function...
  • "cache": A number defining the maximum amount of seconds to cache external data.
  • "invalidate old info": A boolean defining if old data should be considered invalid
1 invocation of hook_connector()
_connector_get_connectors in ./connector.module

File

./connector.api.php, line 32
Hooks provided by the Connector module.

Code

function hook_connector() {
  return array(
    'exampleconnector' => array(
      'title' => 'Example',
      'id callback' => '_exampleconnector_id',
      'button callback' => '_exampleconnector_button',
      'connect button callback' => '_exampleconnector_button',
      'logout callback' => '_exampleconnector_logout',
      'information callback' => '_exampleconnector_info',
      'avatar callback' => '_exampleconnector_avatar',
      'delete callback' => '_exampleconnector_delete',
      'cache' => 72000,
      //20 hours x 3600 seconds per hour
      'invalidate old info' => TRUE,
    ),
  );
}