function token_get_date_token_info in Token 5
Same name and namespace in other branches
- 6 token.module \token_get_date_token_info()
Build a list of common date tokens for use in hook_token_list().
Parameters
$description:
5 calls to token_get_date_token_info()
- comment_token_list in ./
token_comment.inc - Implementation of hook_token_list().
- node_token_list in ./
token_node.inc - Implementation of hook_token_list().
- token_cck.inc in ./
token_cck.inc - token_token_list in ./
token.module - Sample implementation of hook_token_list(). Documents the individual tokens handled by your module.
- user_token_list in ./
token_user.inc - Implementation of hook_token_list().
File
- ./
token.module, line 445 - The Token API module.
Code
function token_get_date_token_info($description, $token_prefix = '') {
$tokens[$token_prefix . 'small'] = t("!description date in 'small' format. <em>(06/07/2010 - 23:28)</em>", array(
'!description' => $description,
));
$tokens[$token_prefix . 'yyyy'] = t("!description year (four digit)", array(
'!description' => $description,
));
$tokens[$token_prefix . 'yy'] = t("!description year (two digit)", array(
'!description' => $description,
));
$tokens[$token_prefix . 'month'] = t("!description month (full word)", array(
'!description' => $description,
));
$tokens[$token_prefix . 'mon'] = t("!description month (abbreviated)", array(
'!description' => $description,
));
$tokens[$token_prefix . 'mm'] = t("!description month (two digits with leading zeros)", array(
'!description' => $description,
));
$tokens[$token_prefix . 'm'] = t("!description month (one or two digits without leading zeros)", array(
'!description' => $description,
));
$tokens[$token_prefix . 'ww'] = t("!description week (two digits with leading zeros)", array(
'!description' => $description,
));
if (version_compare(PHP_VERSION, '5.1.0', '>=')) {
$tokens[$token_prefix . 'date'] = t("!description date (numeric representation of the day of the week)", array(
'!description' => $description,
));
}
$tokens[$token_prefix . 'day'] = t("!description day (full word)", array(
'!description' => $description,
));
$tokens[$token_prefix . 'ddd'] = t("!description day (abbreviation)", array(
'!description' => $description,
));
$tokens[$token_prefix . 'dd'] = t("!description day (two digits with leading zeros)", array(
'!description' => $description,
));
$tokens[$token_prefix . 'd'] = t("!description day (one or two digits without leading zeros)", array(
'!description' => $description,
));
$tokens[$token_prefix . 'raw'] = t("!description in UNIX timestamp format (1269441371)", array(
'!description' => $description,
));
$tokens[$token_prefix . 'since'] = t("!description in 'time-since' format. (40 years 3 months)", array(
'!description' => $description,
));
return $tokens;
}