You are here

function token_requirements in Token 5

Same name and namespace in other branches
  1. 8 token.install \token_requirements()
  2. 6 token.install \token_requirements()
  3. 7 token.install \token_requirements()

Implements hook_requirements().

File

./token.install, line 13
The install and update code for the token module.

Code

function token_requirements($phase = 'runtime') {
  $requirements = array();
  $t = get_t();

  // Check for duplicate tokens.
  if ($phase == 'runtime') {
    if ($duplicate_tokens = token_find_duplicate_tokens()) {
      foreach ($duplicate_tokens as $token => $modules) {
        $duplicate_tokens[$token] = t('@token (defined by modules: @modules)', array(
          '@token' => $token,
          '@modules' => implode(', ', $modules),
        ));
      }
      $requirements['token_duplicates'] = array(
        'title' => $t('Duplicate tokens'),
        'value' => $t('The following tokens are defined by multiple modules and may cause problems when performing token replacement.'),
        'severity' => REQUIREMENT_WARNING,
        'description' => theme('item_list', $duplicate_tokens),
      );
    }
  }
  return $requirements;
}