function crm_core_activity_entity_info in CRM Core 7
Implements hook_entity_info().
File
- modules/
crm_core_activity/ crm_core_activity.module, line 16 - Provides an entity for recording a contact's activities.
Code
function crm_core_activity_entity_info() {
$return = array(
'crm_core_activity' => array(
'label' => t('CRM Core Activity'),
'entity class' => 'CRMCoreActivityEntity',
'controller class' => 'CRMCoreActivityController',
'base table' => 'crm_core_activity',
'revision table' => 'crm_core_activity_revision',
'fieldable' => TRUE,
'entity keys' => array(
'id' => 'activity_id',
'bundle' => 'type',
'label' => 'title',
'revision' => 'revision_id',
),
'bundle keys' => array(
'bundle' => 'type',
),
'bundles' => array(),
'load hook' => 'crm_core_activity_load',
'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_activity_access',
'module' => 'crm_core_activity',
'permission labels' => array(
'singular' => t('activity'),
'plural' => t('activities'),
),
'token type' => 'crm-core-activity',
),
);
$return['crm_core_activity_type'] = array(
'label' => t('CRM Core Activity Type'),
'entity class' => 'CRMActivityType',
'controller class' => 'CRMCoreActivityTypeController',
'features controller class' => 'CRMCoreActivityTypeFeaturesController',
'base table' => 'crm_core_activity_type',
'fieldable' => FALSE,
'bundle of' => 'crm_core_activity',
'exportable' => TRUE,
'entity keys' => array(
'id' => 'id',
'name' => 'type',
'label' => 'label',
),
'module' => 'crm_core_activity',
// Enable the entity API's admin UI.
'admin ui' => array(
'path' => 'admin/structure/crm-core/activity-types',
'file' => 'crm_core_activity.admin.inc',
'controller class' => 'EntityDefaultUIController',
),
'access callback' => 'crm_core_activity_type_access',
'token type' => 'crm-core-activity-type',
);
if (module_exists('uuid')) {
$return['crm_core_activity']['uuid'] = TRUE;
$return['crm_core_activity']['entity keys']['uuid'] = 'uuid';
$return['crm_core_activity']['entity keys']['revision uuid'] = 'vuuid';
}
if (module_exists('entity_translation')) {
$return['crm_core_activity'] += array(
'translation' => array(
'entity_translation' => array(
'base path' => 'crm-core/activity/%crm_core_activity',
),
),
);
}
if (module_exists('title')) {
$field = array(
'type' => 'text',
'cardinality' => 1,
'translatable' => TRUE,
);
$instance = array(
'label' => t('Title'),
'description' => '',
'required' => TRUE,
'settings' => array(
'text_processing' => 0,
),
'widget' => array(
'weight' => -5,
),
'display' => array(
'default' => array(
'type' => 'hidden',
),
),
);
$return['crm_core_activity'] += array(
'field replacement' => array(
'title' => array(
'field' => $field,
'instance' => $instance,
),
),
'efq bundle conditions' => TRUE,
);
}
if (module_exists('inline_entity_form')) {
$return['crm_core_activity']['inline entity form'] = array(
'controller' => 'EntityInlineEntityFormController',
);
}
return $return;
}