You are here

function variable_token_info in Variable 6

Same name and namespace in other branches
  1. 7.2 variable.tokens.inc \variable_token_info()
  2. 7 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_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,
    ),
  );
}