function workflow_token_info in Workflow 7
Same name and namespace in other branches
- 7.2 workflow.tokens.inc \workflow_token_info()
Implements hook_token_info().
File
- ./
workflow.tokens.inc, line 149 - Tokens hooks for Workflow module.
Code
function workflow_token_info() {
$type = array(
'name' => t('Workflow'),
'description' => t('Tokens related to workflows.'),
'needs-data' => 'node',
);
$tokens = array();
$tokens['workflow-name'] = array(
'name' => t('Workflow name'),
'description' => t('Name of workflow applied to this node'),
);
$tokens['workflow-current-state-name'] = array(
'name' => t('Current state name'),
'description' => t('Current state of content'),
);
$tokens['workflow-old-state-name'] = array(
'name' => t('Old state name'),
'description' => t('Old state of content'),
);
$tokens['workflow-current-state-updating-user-name'] = array(
'name' => t('Username of last state changer'),
'description' => t('Username of last state changer'),
);
$tokens['workflow-current-state-updating-user-link'] = array(
'name' => t('Username link of last state changer'),
'description' => t('Themed Username of last state changer'),
);
$tokens['workflow-current-state-updating-user-uid'] = array(
'name' => t('Uid of last state changer'),
'description' => t('uid of last state changer'),
);
$tokens['workflow-current-state-updating-user-mail'] = array(
'name' => t('Email of last state changer'),
'description' => t('email of last state changer'),
);
$tokens['workflow-current-state-updating-user-mail'] = array(
'name' => t('Email link of last state changer'),
'description' => t('email link of last state changer'),
);
$tokens['workflow-current-state-log-entry'] = array(
'name' => t('Last workflow comment log'),
'description' => t('Last workflow comment log'),
);
$tokens['workflow-current-state-date-iso'] = array(
'name' => t('Current state date (ISO)'),
'description' => t('Date of last state change (ISO)'),
);
$tokens['workflow-current-state-date-tstamp'] = array(
'name' => t('Current state date (timestamp)'),
'description' => t('Date of last state change (timestamp)'),
);
$tokens['workflow-current-state-date-formatted'] = array(
'name' => t('Current state date (formatted by site default)'),
'description' => t('Date of last state change (formatted by site default)'),
);
// Add support for custom date formats. (see token.tokens.inc)
// @todo Remove when http://drupal.org/node/1173706 is fixed.
$date_format_types = system_get_date_types();
foreach ($date_format_types as $date_type => $date_info) {
$tokens['workflow-current-state-date-' . $date_type] = array(
'name' => t('Current state date (using @format format)', array(
'@format' => $date_info['title'],
)),
'description' => t("A date in '@type' format. (%date)", array(
'@type' => $date_type,
'%date' => format_date(REQUEST_TIME, $date_type),
)),
'module' => 'workflow',
);
}
return array(
'types' => array(
'workflow' => $type,
),
'tokens' => array(
'workflow' => $tokens,
'node' => $tokens,
),
);
}