function crm_core_contact_entity_info in CRM Core 7
Implements hook_entity_info().
File
- modules/
crm_core_contact/ crm_core_contact.module, line 14 - Provides default CRM Core Contact entities and the ability to create more.
Code
function crm_core_contact_entity_info() {
$return = array(
'crm_core_contact' => array(
'label' => t('CRM Core Contact'),
'entity class' => 'CRMCoreContactEntity',
'controller class' => 'CRMCoreContactController',
'base table' => 'crm_core_contact',
'revision table' => 'crm_core_contact_revision',
'fieldable' => TRUE,
'entity keys' => array(
'id' => 'contact_id',
'revision' => 'vid',
'bundle' => 'type',
// This is used for entityreference lookups(DB queries).
// @see EntityReference_SelectionHandler_Generic::buildEntityFieldQuery()
'label' => 'name',
),
'bundle keys' => array(
'bundle' => 'type',
),
'bundles' => array(),
'view modes' => array(
'full' => array(
'label' => t('Full content'),
'custom settings' => FALSE,
),
),
'label callback' => 'entity_class_label',
'uri callback' => 'entity_class_uri',
'access callback' => 'crm_core_contact_access',
'permission labels' => array(
'singular' => t('contact'),
'plural' => t('contacts'),
),
'token type' => 'crm-core-contact',
),
);
$return['crm_core_contact_type'] = array(
'label' => t('CRM Core Contact type'),
'entity class' => 'CRMContactType',
'controller class' => 'CRMCoreContactTypeController',
'features controller class' => 'CRMCoreContactTypeFeaturesController',
'base table' => 'crm_core_contact_type',
'fieldable' => FALSE,
'bundle of' => 'crm_core_contact',
'exportable' => TRUE,
'entity keys' => array(
'id' => 'id',
'name' => 'type',
'label' => 'name',
),
'module' => 'crm_core_contact',
// Enable the entity API's admin UI.
'admin ui' => array(
'path' => 'admin/structure/crm-core/contact-types',
'file' => 'crm_core_contact.admin.inc',
'controller class' => 'EntityDefaultUIController',
),
'access callback' => 'crm_core_contact_type_access',
'token type' => 'crm-core-contact-type',
);
if (module_exists('uuid')) {
$return['crm_core_contact']['uuid'] = TRUE;
$return['crm_core_contact']['entity keys']['uuid'] = 'uuid';
$return['crm_core_contact']['entity keys']['revision uuid'] = 'vuuid';
}
if (module_exists('entity_translation')) {
$return['crm_core_contact'] += array(
'translation' => array(
'entity_translation' => array(
'base path' => 'crm-core/contact/%crm_core_contact',
),
),
);
}
if (module_exists('inline_entity_form')) {
$return['crm_core_contact']['inline entity form'] = array(
'controller' => 'EntityInlineEntityFormController',
);
}
return $return;
}