function redhen_relation_get_available_types in RedHen CRM 7
Return only relation types between RedHen entities.
Wrapper around relation_get_available_types().
Parameters
RedhenContact|RedhenOrg $entity_type: redhen_contact or redhen_org
string $bundle: Bundle.
Return value
array Available types.
1 call to redhen_relation_get_available_types()
- redhen_relation_connection_form in modules/
redhen_relation/ includes/ redhen_relation.forms.inc - Return a form array for adding/editing a connection.
File
- modules/
redhen_relation/ redhen_relation.module, line 784 - Redhen CRM Relation Module.
Code
function redhen_relation_get_available_types($entity_type, $bundle) {
$relation_types = relation_get_available_types($entity_type, $bundle, 'both');
foreach ($relation_types as $key => $relation_type) {
$redhen_types = array(
'redhen_contact',
'redhen_org',
);
foreach ($relation_type->source_bundles as $source_bundle) {
list($source_entity_type) = explode(':', $source_bundle);
if (!in_array($source_entity_type, $redhen_types)) {
unset($relation_types[$key]);
break;
}
}
foreach ($relation_type->target_bundles as $target_bundle) {
list($target_entity_type) = explode(':', $target_bundle);
if (!in_array($target_entity_type, $redhen_types)) {
unset($relation_types[$key]);
break;
}
}
}
return $relation_types;
}