function content_profile_tokens_token_list in Content Profile 6
Implementation of hook_token_list().
File
- modules/
content_profile_tokens.module, line 62 - Implementations of token module hooks for the content profile module.
Code
function content_profile_tokens_token_list($type = 'all') {
$tokens = array();
if ($type == 'user' || $type == 'all') {
$types = content_profile_get_types('types');
foreach ($types as $type_name => $type) {
$fields = content_types($type_name);
foreach ($fields['fields'] as $field_name => $field) {
if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
$tokens['user']['content-profile-' . $type_name . '-' . substr($field_name, 6)] = t($fields['description']) . '-' . t($field['widget']['label']);
$tokens['user']['content-profile-' . $type_name . '-' . substr($field_name, 6) . '-raw'] = t($fields['description']) . '-' . t($field['widget']['label']) . ' ' . t('WARNING - raw user input');
}
}
}
}
if ($type == 'flag_friend' && module_exists('flag_friend')) {
foreach ($types as $type_name => $type) {
$fields = content_types($type_name);
foreach ($fields['fields'] as $field_name => $field) {
if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
$tokens['content_profile_flag_friend']['requestor-' . $type_name . '-' . substr($field_name, 6)] = t('Requestor:') . t($fields['description']) . '-' . t($field['widget']['label']);
$tokens['content_profile_flag_friend']['requestor-' . $type_name . '-' . substr($field_name, 6) . '-raw'] = t('Requestor:') . t($fields['description']) . '-' . t($field['widget']['label']) . ' ' . t('WARNING - raw user input');
$tokens['content_profile_flag_friend']['requestee-' . $type_name . '-' . substr($field_name, 6)] = t('Requestee:') . t($fields['description']) . '-' . t($field['widget']['label']);
$tokens['content_profile_flag_friend']['requestee-' . $type_name . '-' . substr($field_name, 6) . '-raw'] = t('Requestee:') . t($fields['description']) . '-' . t($field['widget']['label']) . ' ' . t('WARNING - raw user input');
}
}
}
}
return $tokens;
}