function user_relationships_type_load in User Relationships 6
Same name and namespace in other branches
- 5.3 user_relationships_api/user_relationships_api.api.inc \user_relationships_type_load()
- 5.2 user_relationships_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.
$reset: a boolean that forces a reset of the internal static types list
Return value
object of the requested relationship type
28 calls to user_relationships_type_load()
- template_preprocess_user_relationships in user_relationships_ui/
user_relationships_ui.module - Pre processor for user_relationships page
- theme_user_relationship_block_subject in user_relationship_blocks/
user_relationship_blocks.module - Theme function to generate the title of a block
- user_relationships_api_can_receive in user_relationships_api/
user_relationships_api.api.inc - Check whether a user is allowed to receive a certain relationship type
- user_relationships_api_can_request in user_relationships_api/
user_relationships_api.api.inc - Check whether a user is allowed to request a certain relationship type
- user_relationships_api_socnet_relation_type in user_relationships_api/
user_relationships_api.socnet.inc - return 'two-way' or 'one-way' depending on the relation type
File
- user_relationships_api/
user_relationships_api.api.inc, line 25 - User Relationships API. Data abstraction layer @author Jeff Smick (creator) @author Alex Karshakevich (maintainer) http://drupal.org/user/183217
Code
function user_relationships_type_load($param = array(), $reset = NULL) {
$types = user_relationships_types_load($reset);
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;
}
}
}