function flag_token_list in Flag 5
Same name and namespace in other branches
- 6.2 includes/flag.token.inc \flag_token_list()
- 6 includes/flag.token.inc \flag_token_list()
Implementation of hook_token_list().
File
- includes/
flag.token.inc, line 11 - Flag module tokens support.
Code
function flag_token_list($type = 'all') {
$tokens = array();
if ($type == 'flag' || $type == 'all') {
$tokens['flag']['flag-name'] = t('The flag name.');
$tokens['flag']['flag-title'] = t('The flag title.');
}
if ($type == 'flag-action' || $type == 'all') {
$tokens['flag-action']['flag-action'] = t('The flagging action taking place.');
$tokens['flag-action']['flag-content-url'] = t('The URL of the content being flagged.');
$tokens['flag-action']['flag-content-title'] = t('The title of the content being flagged.');
$tokens['flag-action']['flag-content-type'] = t('The type of content being flagged, such as <em>node</em> or <em>comment</em>.');
$tokens['flag-action']['flag-content-id'] = t('The ID of content being flagged, may be a nid or cid.');
$tokens['flag-action']['flag-count'] = t('The current count total for this flag.');
}
foreach (flag_get_types() as $flag_type) {
if ($type == $flag_type || $type == 'all') {
$flags = flag_get_flags($flag_type);
foreach ($flags as $flag) {
$tokens[$flag_type]['flag-' . str_replace('_', '-', $flag->name) . '-count'] = t('Total flag count for flag @flag', array(
'@flag' => $flag
->get_title(),
));
}
}
}
return $tokens;
}