You are here

function api_tokens_prepare_handler in API Tokens 7

Prepares token process function.

Includes handler file, verifies function existence.

2 calls to api_tokens_prepare_handler()
api_tokens_page_format_synopsis in includes/api_tokens.admin.inc
Renders synopsis cell.
api_tokens_render in ./api_tokens.module
Processes API tokens.

File

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

Code

function api_tokens_prepare_handler($token) {
  $tokens =& drupal_static('api_tokens_collect_tokens', FALSE);

  // Checking for inc file where token process function may live.
  if (isset($tokens[$token]['inc'])) {

    // Trying to include.
    $included = module_load_include('inc', $tokens[$token]['module'], $tokens[$token]['inc']);
    if (!$included) {
      return FALSE;
    }
  }

  // Checking process function existence.
  if (!function_exists($tokens[$token]['handler'])) {
    return FALSE;
  }
  return TRUE;
}