function user_relationshipsactivity_token_values in Activity 6
Same name and namespace in other branches
- 5.4 contrib/user_relationshipsactivity/user_relationshipsactivity.module \user_relationshipsactivity_token_values()
- 5.3 contrib/user_relationshipsactivity/user_relationshipsactivity.module \user_relationshipsactivity_token_values()
Token module integration. Defines available default token values.
File
- contrib/
user_relationshipsactivity/ user_relationshipsactivity.module, line 87
Code
function user_relationshipsactivity_token_values($type, $data = NULL, $options = array()) {
global $user;
static $relationships;
if ($type == 'user_relationshipsactivity' && !empty($data)) {
$requestee = activity_user_load($data['requestee-uid']);
$data['is-are'] = $data['uid'] == $user->uid ? 'are' : 'is';
$data['requestee'] = theme('activity_username', $requestee, TRUE);
$data['requestee-all'] = theme('activity_username', $requestee);
$data['requestee-name'] = $requestee->name;
$data['requestee-picture'] = theme('activity_user_picture', $requestee);
if (!isset($relationships[$data['relationship-type-id']])) {
$relationships[$data['relationship-type-id']] = user_relationships_type_load($data['relationship-type-id']);
}
$relationship = $relationships[$data['relationship-type-id']];
$data['relationship'] = $relationship->name;
$data['relationship-plural'] = $relationship->plural_name;
return $data;
}
}