You are here

function token_module_implements_alter in Token 7

Same name and namespace in other branches
  1. 8 token.module \token_module_implements_alter()

Implements hook_module_implements_alter().

Adds missing token support for core modules.

File

./token.module, line 460
Enhances the token API in core: adds a browseable UI, missing tokens, etc.

Code

function token_module_implements_alter(&$implementations, $hook) {
  module_load_include('inc', 'token', 'token.tokens');
  if ($hook == 'tokens' || $hook == 'token_info' || $hook == 'token_info_alter' || $hook == 'tokens_alter') {
    foreach (_token_core_supported_modules() as $module) {
      if (module_exists($module) && function_exists($module . '_' . $hook)) {
        $implementations[$module] = FALSE;
      }
    }

    // Move token.module to get included first since it is responsible for
    // other modules.
    unset($implementations['token']);
    $implementations = array_merge(array(
      'token' => 'tokens',
    ), $implementations);
  }
}