function crm_core_relationship_install in CRM Core 8.2
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()
- 7 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 14 - 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('Friend of'),
'source_bundles' => array(
'crm_core_contact:individual',
),
'r_unique' => TRUE,
),
array(
'relation_type' => 'crm_employee',
'label' => $t('Employee of'),
'reverse_label' => $t('Employer of'),
'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('Member of'),
'reverse_label' => $t('Household for'),
'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) {
RelationType::create($relation_type_info)
->save();
}
}