You are here

function api_tokens_populate_defaults in API Tokens 7

Populates omitted token info.

1 call to api_tokens_populate_defaults()
api_tokens_collect_tokens in ./api_tokens.module
Collects information on all the tokens in the system.

File

./api_tokens.module, line 55
The API Tokens module

Code

function api_tokens_populate_defaults($token, &$token_info, $module) {
  $token_info['key'] = $token;
  $token_info['module'] = $module;
  if (!isset($token_info['title'])) {
    $token_info['title'] = $token;
  }
  if (!isset($token_info['description'])) {
    $token_info['description'] = '';
  }
  if (!isset($token_info['handler'])) {
    $token_info['handler'] = $module . '_apitoken_' . str_replace(array(
      '-',
      ':',
    ), '_', $token);
  }
  if (!isset($token_info['cache'])) {
    $token_info['cache'] = DRUPAL_NO_CACHE;
  }
  if (DRUPAL_NO_CACHE != $token_info['cache']) {
    $token_info['cache_expire'] = isset($token_info['cache_expire']) ? (int) $token_info['cache_expire'] : CACHE_TEMPORARY;
  }
}