You are here

function crm_core_contact_type_get_name in CRM Core 7

Returns the human readable name of any or all contact types.

Parameters

string|null $type: (optional) Specify the type whose name to return.

Return value

If $type is specified, a string containing the human readable name of the type. If $type isn't specified an array containing all human readable names keyed on the machine type.

6 calls to crm_core_contact_type_get_name()
CRMFeedsContactProcessor::configDefaults in modules/crm_core_contact/includes/CRMFeedsContactProcessor.inc
Override parent::configDefaults().
CRMFeedsContactProcessor::configForm in modules/crm_core_contact/includes/CRMFeedsContactProcessor.inc
Override parent::configForm().
crm_core_contact_entity_info_alter in modules/crm_core_contact/crm_core_contact.module
Implements hook_entity_info_alter().
crm_core_contact_handler_field_contact_type::render in modules/crm_core_contact/includes/views/handlers/crm_core_contact_handler_field_contact_type.inc
Render callback.
crm_core_contact_search_execute in modules/crm_core_contact/crm_core_contact.module
Implements hook_search_execute().

... See full list

1 string reference to 'crm_core_contact_type_get_name'
crm_core_contact_views_data in modules/crm_core_contact/includes/views/crm_core_contact.views.inc
Implements hook_views_data().

File

modules/crm_core_contact/crm_core_contact.module, line 652
Provides default CRM Core Contact entities and the ability to create more.

Code

function crm_core_contact_type_get_name($type = NULL) {
  $contact_types = crm_core_contact_types();

  // If type is set return the name if it exists.
  if (!empty($type)) {
    if (isset($contact_types[$type])) {
      return $contact_types[$type]->name;
    }
    else {
      return FALSE;
    }
  }

  // Otherwise return a mapping of type => name.
  foreach ($contact_types as $key => $value) {
    $contact_types[$key] = $value->name;
  }
  return $contact_types;
}