function crm_core_contact_types in CRM Core 7
Returns an array of contact type objects keyed by type.
Parameters
bool $active: TRUE if we only want to select active contact types FALSE if we want to select all contact types
Return value
array $contact_types An numeric index array of contact types (machine names)
16 calls to crm_core_contact_types()
- CRMFeedsContactProcessor::getMappingTargets in modules/
crm_core_contact/ includes/ CRMFeedsContactProcessor.inc - Return available mapping targets.
- crm_core_contact_access in modules/
crm_core_contact/ crm_core_contact.module - Check permission for various contact operations.
- crm_core_contact_context_condition_contact_type::condition_values in modules/
crm_core_contact/ includes/ context/ crm_core_contact_context_condition_contact_type.inc - Condition values.
- crm_core_contact_type_get_name in modules/
crm_core_contact/ crm_core_contact.module - Returns the human readable name of any or all contact types.
- crm_core_contact_ui_add_page in modules/
crm_core_contact_ui/ crm_core_contact_ui.pages.inc - Show a list of contact types that can be added into the CRM.
1 string reference to 'crm_core_contact_types'
- CRMCoreContactTypeController::save in modules/
crm_core_contact/ includes/ crm_core_contact_type.controller.inc - Overrides a method of the EntityAPIControllerExportable class.
File
- modules/
crm_core_contact/ crm_core_contact.module, line 625 - Provides default CRM Core Contact entities and the ability to create more.
Code
function crm_core_contact_types($active = FALSE) {
// First check the static cache for a contact types array.
$contact_types =& drupal_static(__FUNCTION__);
// If it did not exist, fetch the types now.
if ($active && !isset($contact_types['active'])) {
$contact_types['active'] = db_query('SELECT * FROM {crm_core_contact_type} WHERE disabled = 0')
->fetchAllAssoc('type');
}
elseif (!$active && !isset($contact_types['all'])) {
$contact_types['all'] = db_query('SELECT * FROM {crm_core_contact_type}')
->fetchAllAssoc('type');
}
return $active ? $contact_types['active'] : $contact_types['all'];
}