function civicrm_entity_menu_alter in CiviCRM Entity 7
Same name and namespace in other branches
- 7.2 civicrm_entity.module \civicrm_entity_menu_alter()
Implements hook_menu_later().
Entity API creates all the fields page links but the basic 'manage' page is missing so we use the /fields page at that url
File
- ./
civicrm_entity.module, line 14 - Implement CiviCRM entities as a Drupal Entity.
Code
function civicrm_entity_menu_alter(&$items) {
foreach (entity_get_info() as $entity_name => $entity_info) {
if (!empty($entity_info['module']) && $entity_info['module'] == 'civicrm_entity') {
foreach ($entity_info['bundles'] as $file_type => $bundle_info) {
if (isset($bundle_info['admin'])) {
// Get the base path and access.
$path = $bundle_info['admin']['path'];
$items[$path] = $items[$path . '/fields'];
$items[$path]['type'] = MENU_NORMAL_ITEM;
$items[$path]['title'] = $entity_info['label'];
$items[$path]['description'] = t('CiviCRM @entity entity', array(
'@entity' => $entity_name,
));
$items[$path . '/fields']['type'] = MENU_DEFAULT_LOCAL_TASK;
}
}
}
}
}