function entityconnect_eck_entityconnect_add_info in Entity connect 7.2
Implements hook_entityconnect_add_info().
File
- modules/
entityconnect_eck/ entityconnect_eck.module, line 122
Code
function entityconnect_eck_entityconnect_add_info($cache_id, $entity_type, $acceptable_types) {
if (!isset($entity_type)) {
throw new \Exception(t('Entity type can not be empty'));
}
$entity_info = entity_get_info($entity_type);
if (isset($entity_info['module']) && $entity_info['module'] == 'eck') {
// Only one allowed, no need for the intermediate step.
if (count($acceptable_types) > 0) {
foreach ($acceptable_types as $bundle_name) {
$bundle = $entity_info['bundles'][$bundle_name];
$content[$bundle_name] = array(
'href' => $bundle['crud']['add']['path'] . "/{$cache_id}",
'label' => $bundle['label'],
'description' => '',
);
}
}
else {
foreach ($entity_info['bundles'] as $key => $bundle) {
$content[$key] = array(
'href' => $bundle['crud']['add']['path'] . "/{$cache_id}",
'label' => $bundle['label'],
'description' => '',
);
}
}
return array(
'content' => $content,
);
}
}