function field_entity_entity_info in Field entity 7
Implements hook_entity_info().
File
- ./
field_entity.module, line 10 - Field and Field Instance entity definitions.
Code
function field_entity_entity_info() {
$items = array();
$items['field_entity'] = array(
'label' => t('Field'),
'plural label' => t('Fields'),
'base table' => 'field_config',
'fieldable' => FALSE,
'entity keys' => array(
'id' => 'id',
'label' => 'field_name',
),
'module' => 'field_entity',
'access callback' => 'field_entity_field_entity_access',
);
$items['field_instance_entity'] = array(
'label' => t('Field instance'),
'plural label' => t('Field instances'),
'controller class' => 'FieldInstanceEntityController',
'base table' => 'field_config_instance',
'label callback' => 'field_entity_field_instance_entity_label',
'fieldable' => FALSE,
'entity keys' => array(
'id' => 'id',
'bundle' => 'entity_type_bundle',
),
'module' => 'field_entity',
'access callback' => 'field_entity_field_instance_entity_access',
'bundles' => array(),
);
$entity_bundles = array();
foreach (field_info_field_map() as $field_name => $info) {
foreach ($info['bundles'] as $entity_type => $bundles) {
foreach ($bundles as $bundle) {
$key = $entity_type . ':' . $bundle;
if (!isset($entity_bundles[$key])) {
$entity_bundles[$key] = $key;
}
}
}
}
foreach ($entity_bundles as $type => $name) {
$items['field_instance_entity']['bundles'][$type] = array(
'label' => $name,
);
}
return $items;
}