You are here

function variable_tokens in Variable 7

Same name and namespace in other branches
  1. 6 variable.tokens.inc \variable_tokens()
  2. 7.2 variable.tokens.inc \variable_tokens()

Implements hook_tokens().

File

./variable.tokens.inc, line 38
Builds placeholder replacement tokens system-wide data.

Code

function variable_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $replacements = array();
  if ($type == 'variable') {
    foreach ($tokens as $name => $original) {
      $variable = variable_get_info($name, $options);
      if ($variable && !empty($variable['token'])) {
        $replacements[$original] = variable_format_value($variable, $options);
      }
    }
  }
  return $replacements;
}