function flag_token_get_list in Flag 6.2
Same name and namespace in other branches
- 5 includes/flag.token.inc \flag_token_get_list()
- 6 includes/flag.token.inc \flag_token_get_list()
This is a replacement for Token's token_get_list().
It is used only by theme_flag_tokens_browser(), above.
This is a duplicate of the Token's function, but with a small modification: the $type parameter is now $types, allowing for listing tokens from several categories.
@todo Incorporate this feature into the Token module(?)
1 call to flag_token_get_list()
- theme_flag_tokens_browser in includes/
flag.token.inc - This is a replacement for Token's theme_token_help().
File
- includes/
flag.token.inc, line 104 - Flag module tokens support.
Code
function flag_token_get_list($types = array(
'all',
)) {
token_include();
$return = array();
foreach ($types as $type) {
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;
}
}
}
}
}
// For aesthetic reasons, we don't want the 'global' section to appear in
// varying places, so let's move it to the bottom.
if (isset($return['global'])) {
$global = $return['global'];
unset($return['global']);
$return['global'] = $global;
}
return $return;
}