function variable_token_info in Variable 7
Same name and namespace in other branches
- 6 variable.tokens.inc \variable_token_info()
- 7.2 variable.tokens.inc \variable_token_info()
Implements hook_token_info().
File
- ./variable.tokens.inc, line 13 
- Builds placeholder replacement tokens system-wide data.
Code
function variable_token_info() {
  $types['variable'] = array(
    'name' => t("Variables"),
    'description' => t("Tokens for variable values."),
  );
  $variable = array();
  foreach (variable_get_info() as $name => $info) {
    if (!empty($info['token'])) {
      $variable[$name] = array(
        'name' => $info['title'],
        'description' => !empty($info['description']) ? $info['description'] : t('Value of variable !name', array(
          '!name' => $info['title'],
        )),
      );
    }
  }
  return array(
    'types' => $types,
    'tokens' => array(
      'variable' => $variable,
    ),
  );
}