function votingapi_tokens_token_info in Voting API 8.3
Implements hook_token_info().
File
- modules/
votingapi_tokens/ votingapi_tokens.tokens.inc, line 15 - Contains votingapi_tokens.tokens.inc.
Code
function votingapi_tokens_token_info() {
$entity_types = _votingapi_tokens_get_entity_types();
$types = [];
$tokens = [];
foreach ($entity_types as $entity_type) {
$types['votingapi_' . $entity_type . '_token'] = [
'name' => t('VotingAPI tokens'),
'description' => t('Dynamic Tokens for VotingAPI.'),
'needs-data' => $entity_type,
];
$tokens['votingapi_' . $entity_type . '_token']['vote_count'] = [
'name' => t('Vote count'),
'dynamic' => TRUE,
'description' => t('Number of votes.'),
];
$tokens['votingapi_' . $entity_type . '_token']['vote_average'] = [
'name' => t('Average Result'),
'dynamic' => TRUE,
'description' => t('Average result of votes.'),
];
$tokens['votingapi_' . $entity_type . '_token']['best_vote'] = [
'name' => t('Best Vote'),
'dynamic' => TRUE,
'description' => t('Best Vote cast.'),
];
$tokens['votingapi_' . $entity_type . '_token']['worst_vote'] = [
'name' => t('Worst Vote'),
'dynamic' => TRUE,
'description' => t('Worst Vote cast.'),
];
}
return [
'types' => $types,
'tokens' => $tokens,
];
}