Implements hook_menu().
function field_ui_menu() {
$items['admin/reports/fields'] = array(
'title' => 'Field list',
'description' => 'Overview of fields on all entity types.',
'page callback' => 'field_ui_fields_list',
'access arguments' => array(
'administer content types',
),
'type' => MENU_NORMAL_ITEM,
'file' => 'field_ui.admin.inc',
);
$items['admin/reports/fields/list'] = array(
'title' => 'Entities',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
// Create tabs for all possible bundles.
foreach (entity_get_info() as $entity_type => $entity_info) {
if ($entity_info['fieldable'] && isset($entity_info['route_base_path'])) {
// Extract path information from the entity type.
$path = $entity_info['route_base_path'];
$default_path = preg_replace('/{' . DRUPAL_PHP_FUNCTION_PATTERN . '}/', '%', $path);
// This is the position of the %field_ui_instance placeholder in the
// items below.
$field_position = count(explode('/', $path)) + 1;
$items["{$path}/fields"] = array(
'title' => 'Manage fields',
'type' => MENU_LOCAL_TASK,
'route_name' => "field_ui.overview.{$entity_type}",
'weight' => 1,
);
$items["{$path}/fields/%"] = array(
'title callback' => 'field_ui_instance_title',
'title arguments' => array(
$field_position,
),
'route_name' => "field_ui.instance_edit.{$entity_type}",
);
$items["{$default_path}/fields/%/edit"] = array(
'title' => 'Edit',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items["{$path}/fields/%/field"] = array(
'title' => 'Field settings',
'type' => MENU_LOCAL_TASK,
'route_name' => "field_ui.field_edit.{$entity_type}",
);
$items["{$path}/fields/%/widget-type"] = array(
'title' => 'Widget type',
'type' => MENU_LOCAL_TASK,
'route_name' => "field_ui.widget_type.{$entity_type}",
);
$items["{$path}/fields/%/delete"] = array(
'title' => 'Delete',
'type' => MENU_VISIBLE_IN_BREADCRUMB,
'route_name' => "field_ui.delete.{$entity_type}",
'weight' => 10,
);
// 'Manage display' tab.
$items["{$path}/display"] = array(
'title' => 'Manage display',
'type' => MENU_LOCAL_TASK,
'route_name' => "field_ui.display_overview.{$entity_type}",
'weight' => 2,
);
// View modes secondary tabs.
// The same base $path for the menu item (with a placeholder) can be
// used for all bundles of a given entity type; but depending on
// administrator settings, each bundle has a different set of view
// modes available for customisation. So we define menu items for all
// view modes, and use a route requirement to determine which ones are
// actually visible for a given bundle.
$items["{$default_path}/display/default"] = array(
'title' => t('Default'),
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$weight = 0;
foreach (entity_get_view_modes($entity_type) as $view_mode => $view_mode_info) {
$items["{$path}/display/{$view_mode}"] = array(
'title' => $view_mode_info['label'],
'type' => MENU_LOCAL_TASK,
'weight' => $weight++,
'route_name' => "field_ui.display_overview.{$entity_type}.{$view_mode}",
);
}
}
}
return $items;
}