You are here

function token_requirements in Token 7

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

Implements hook_requirements().

File

./token.install, line 11
Install, update and uninstall functions for the token module.

Code

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

    // Check for various token definition problems.
    $token_problems = token_get_token_problems();

    // Format and display each token problem.
    foreach ($token_problems as $problem_key => $problem) {
      if (!empty($problem['problems'])) {
        $problems = array_unique($problem['problems']);
        $problems = array_map('check_plain', $problems);
        $token_problems[$problem_key] = $problem['label'] . theme('item_list', array(
          'items' => $problems,
        ));
        $requirements['token-' . $problem_key] = array(
          'title' => $problem['label'],
          'value' => theme('item_list', array(
            'items' => $problems,
          )),
          'severity' => $problem['severity'],
        );
      }
    }
  }
  return $requirements;
}