function user_relationships_type_load in User Relationships 5.2
Same name and namespace in other branches
- 5.3 user_relationships_api/user_relationships_api.api.inc \user_relationships_type_load()
- 6 user_relationships_api/user_relationships_api.api.inc \user_relationships_type_load()
- 7 user_relationships.module \user_relationships_type_load()
Public API for retrieving a specific relationship
Parameters
$param: The rtid or an associative array of attributes to search for in selecting the relationship, such as rtid or name. Attributes must match column names in the user_relationship_types table.
Return value
object of the requested relationship type
26 calls to user_relationships_type_load()
- theme_user_relationships_page in ./
user_relationships_theme.inc - Categorized list of relationships for a given user
- theme_user_relationship_block_empty in plugins/
user_relationship_blocks/ user_relationship_blocks.module - Generate the content of an empty My/User Relationships block
- theme_user_relationship_block_subject in plugins/
user_relationship_blocks/ user_relationship_blocks.module - Generate the title of a My/User Relationships block
- user_relationships_get_message in ./
user_relationships_api.inc - Public API for getting the set or default message
- user_relationships_request in ./
user_relationships_forms.inc - Request a new relationship with another user
File
- ./
user_relationships_api.inc, line 19
Code
function user_relationships_type_load($param = array()) {
if (!$param) {
return;
}
$types = user_relationships_types_load();
if (is_numeric($param)) {
return $types[$param];
}
foreach ($types as $type) {
$found = TRUE;
foreach ($param as $column => $value) {
$column = strtolower($column);
if ($column == 'name' || $column == 'plural_name') {
$value = strtolower($value);
$col_val = strtolower($type->{$column});
}
else {
$col_val = $type->{$column};
}
// mismatch, move to the next type
if ($col_val != $value) {
$found = FALSE;
break;
}
}
if ($found) {
return $type;
}
}
}