Calling all Drupal developers!
Help us get this on the first page of Digg. DIGG NOW!
Help us get this on the first page of Digg. DIGG NOW!
token_get_list($type = 'all')
contributions/token/token.module, line 293
A helper function that retrieves all currently exposed tokens, and merges them recursively. This is only necessary when building the token listing -- during actual value replacement, only tokens in a particular domain are requested and a normal array_marge() is sufficient.
type A flag indicating the class of substitution tokens to use. If an object is passed in the second param, 'type' should contain the object's type. For example, 'node', 'comment', or 'user'. If no type is specified, only 'global' site-wide substitution tokens are built.
The array of usable tokens and their descriptions, organized by token type.
<?php
function token_get_list($type = 'all') {
token_include();
$return = array();
foreach (module_implements('token_list') as $module) {
$function = $module .'_token_list';
$result = $function($type);
if (is_array($result)) {
foreach ($result as $category => $tokens) {
foreach ($tokens as $token => $title) {
$return[$category][$token] = $title;
}
}
}
}
return $return;
}
?>