function _token_upgrade_token_list in Token 7
Same name and namespace in other branches
- 8 token.install \_token_upgrade_token_list()
Build a list of Drupal 6 tokens and their Drupal 7 token names.
1 call to _token_upgrade_token_list()
- token_update_token_text in ./
token.install - Update a string containing Drupal 6 style tokens to Drupal 7 style tokens.
File
- ./
token.install, line 85 - Install, update and uninstall functions for the token module.
Code
function _token_upgrade_token_list() {
$tokens = array(
// Global tokens
'user-name' => 'current-user:name',
'user-id' => 'current-user:id',
'user-mail' => 'current-user:mail',
'site-url' => 'site:url',
'site-name' => 'site:name',
'site-slogan' => 'site:slogan',
'site-mission' => 'site:mission',
'site-mail' => 'site:mail',
'site-date' => 'date:short',
//'site-date-' => '', // Date tokens expanded below
'current-page-path' => 'current-page:path',
'current-page-url' => 'current-page:url',
'page-number' => 'current-page:page-number',
// Comment tokens
'comment-cid' => 'comment:cid',
'comment-nid' => 'comment:node:nid',
'comment-title' => 'comment:title',
'comment-body' => 'comment:body',
'comment-author-name' => 'comment:author:name',
'comment-author-mail' => 'comment:author:mail',
//'comment-body-format' => '',
//'comment-' => '', // Date tokens expanded below
'comment-node-title' => 'comment:node',
// Node tokens
'nid' => 'node:nid',
'type' => 'node:type',
'type-name' => 'node:type-name',
'language' => 'node:language',
'title' => 'node:title',
'author-uid' => 'node:author:uid',
'author-name' => 'node:author:name',
'author-mail' => 'node:author:mail',
'node_comment_count' => 'node:comment-count',
'unread_comment_count' => 'node:comment-count-new',
'log' => 'node:log',
//'' => '', // Date tokens expanded below
//'mod-' => '', // Date tokens expanded below
'menupath' => 'node:menu-link:parent:path][node:menu-link',
'menu' => 'node:menu-link:menu-name',
'menu-link-title' => 'node:menu-link',
'menu-link-mlid' => 'node:menu-link:mlid',
'menu-link-plid' => 'node:menu-link:parent:mlid',
//'term' => 'node:term',
//'term-id' => 'node:term:tid',
//'vocab' => 'node:term:vocabulary',
//'vocab-id' => 'node:term:vocabulary:vid',
// Book tokens
//'book' => 'node:book',
//'book_id' => 'node:book:bid',
//'bookpath' => 'node:book:path',
// Taxonomy tokens
'tid' => 'term:tid',
'cat' => 'term:name',
'cat-description' => 'term:description',
'vid' => 'term:vocabulary:vid',
'vocab' => 'term:vocabulary',
'vocab-description' => 'term:vocabulary:description',
// User tokens
'user' => 'user:name',
'uid' => 'user:uid',
'mail' => 'user:mail',
'reg-date' => 'user:created',
'reg-since' => 'user:created:since',
//'user-created' => '', // Date tokens expanded below
'log-date' => 'user:last-login',
'log-since' => 'user:last-login:since',
//'user-last-login' => '', // Date tokens expanded below
//'date-in-tz' => '',
'account-url' => 'user:url',
'account-edit' => 'user:edit-url',
);
// Account for date tokens which need to be expanded.
$tokens += _token_upgrade_token_date_list('site-', 'site:date');
$tokens += _token_upgrade_token_date_list('', 'node:created');
$tokens += _token_upgrade_token_date_list('mod-', 'node:changed');
//$tokens += _token_upgrade_token_date_list('node-revision-', 'node:changed');
$tokens += _token_upgrade_token_date_list('comment-', 'comment:created');
$tokens += _token_upgrade_token_date_list('user-register-', 'user:created');
$tokens += _token_upgrade_token_date_list('user-last-login-', 'user:last-login');
return $tokens;
}