function backports_menu_alter in Backports 7
Implements hook_menu_alter().
See also
File
- ./
backports.module, line 12 - backports.module Hook implementations for Backports.
Code
function backports_menu_alter(&$items) {
foreach (entity_get_info() as $entity_type => $entity_info) {
if ($entity_info['fieldable']) {
foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) {
if (isset($bundle_info['admin'])) {
$path = $bundle_info['admin']['path'];
// Don't act if the Field UI module's menu items are missing (e.g.,
// if the module is disabled).
if (isset($items["{$path}/fields"])) {
// Remove "Delete" from the tabs.
$items["{$path}/fields/%field_ui_menu/delete"]['type'] = MENU_VISIBLE_IN_BREADCRUMB;
// Replace the field settings page with one that will redirect to
// the general field editing page.
$field_settings_path = "{$path}/fields/%field_ui_menu/field-settings";
// Since different bundles often share the same admin path, we can
// wind up here multiple times. Don't run the code more than once,
// since it's not idempotent.
if ($items[$field_settings_path]['page callback'] != 'backports_redirect_to_field_edit_page') {
$items[$field_settings_path]['type'] = MENU_CALLBACK;
$items[$field_settings_path]['page callback'] = 'backports_redirect_to_field_edit_page';
// Pass along the second page argument from the original menu
// item, which contains the position of the %field_ui_menu
// placeholder.
$items[$field_settings_path]['page arguments'] = array(
$items[$field_settings_path]['page arguments'][1],
);
}
}
}
}
}
}
}