function user_relationships_type_get_name in User Relationships 7
Gets the relationship type name.
16 calls to user_relationships_type_get_name()
- UserRelationshipsTypesTestCase::testNames in ./
user_relationships.test - user_relationships_admin_types_list_page in ./
user_relationships.admin.inc - Relationship Types List
- user_relationships_autocomplete_types in ./
user_relationships.module - Adds autocompletion capability
- user_relationships_get_requestable_rtypes in ./
user_relationships.module - Get relationship types that a user can request from another user.
- user_relationships_request_relationship in ./
user_relationships.module - Request a new user relationship
File
- ./
user_relationships.module, line 1069 - User Relationships API. Module shell.
Code
function user_relationships_type_get_name($type, $plural = FALSE, $reversed = FALSE, $capitalized = FALSE) {
// Start with just name as the name and then add suffixes and prefixes
// according to the given flags.
$name = 'name';
if ($plural) {
$name = 'plural_' . $name;
}
if ($reversed) {
$name = 'reverse_' . $name;
}
if ($capitalized) {
$name .= '_capitalized';
}
if (is_string($type)) {
$type = user_relationships_type_load($type);
}
// Attemt to translate the name.
if (module_exists('i18n_string')) {
$string_object = i18n_string_object_translate('user_relationships_type', $type);
$name_value = !empty($string_object->{$name}) ? $string_object->{$name} : $string_object->name;
}
else {
$name_value = !empty($type->{$name}) ? $type->{$name} : $type->name;
}
return $name_value;
}