function uc_addresses_token_list in Ubercart Addresses 6
Same name and namespace in other branches
- 6.2 uc_addresses.module \uc_addresses_token_list()
Implementation of hook_token_list().
File
- ./
uc_addresses.module, line 205
Code
function uc_addresses_token_list($type = 'all') {
$tokens = array();
if ($type === 'user' || $type === 'all') {
// List out plain and raw tokens for all columns in the uc_addresses table
$schema = drupal_get_schema('uc_addresses');
$exclude = array(
'aid',
'uid',
'created',
'modified',
);
foreach ($schema['fields'] as $key => $field) {
if ($key === 'created' || $key === 'modified') {
$tokens[t('Ubercart Addresses') . ' - ' . t('Default address')] += token_get_date_token_info($field['description'], 'uc-addresses-default-' . $key . '-');
}
else {
$tokens[t('Ubercart Addresses') . ' - ' . t('Default address')]['uc-addresses-default-' . $key] = $field['description'];
}
if (!in_array($key, $exclude)) {
// For some fields we don't need raw tokens.
$tokens[t('Ubercart Addresses') . ' - ' . t('Default address')]['uc-addresses-default-' . $key . '-raw'] = $field['description'];
}
}
}
return $tokens;
}