function crm_core_relationship_install in CRM Core 7
Same name and namespace in other branches
- 8.3 modules/crm_core_relationship/crm_core_relationship.install \crm_core_relationship_install()
- 8 modules/crm_core_relationship/crm_core_relationship.install \crm_core_relationship_install()
- 8.2 modules/crm_core_relationship/crm_core_relationship.install \crm_core_relationship_install()
Implements hook_install().
File
- modules/
crm_core_relationship/ crm_core_relationship.install, line 11 - Install, update and uninstall functions for the relationship module.
Code
function crm_core_relationship_install() {
$t = get_t();
// Add default relationships
$relation_types_info = array(
array(
'relation_type' => 'crm_friend',
'label' => $t('is friends with'),
'source_bundles' => array(
'crm_core_contact:individual',
),
'r_unique' => TRUE,
),
array(
'relation_type' => 'crm_employee',
'label' => $t('works for'),
'reverse_label' => $t('employs'),
'directional' => TRUE,
'r_unique' => TRUE,
'source_bundles' => array(
'crm_core_contact:individual',
),
'target_bundles' => array(
'crm_core_contact:organization',
),
),
array(
'relation_type' => 'crm_member',
'label' => $t('is a member of'),
'reverse_label' => $t('has member'),
'directional' => TRUE,
'r_unique' => TRUE,
'source_bundles' => array(
'crm_core_contact:individual',
),
'target_bundles' => array(
'crm_core_contact:household',
),
),
);
foreach ($relation_types_info as $relation_type_info) {
$relation_type = relation_type_create($relation_type_info);
relation_type_save($relation_type);
}
}