Implements hook_menu().
function translation_entity_menu() {
$items = array();
// Create tabs for all possible entity types.
foreach (entity_get_info() as $entity_type => $info) {
// Provide the translation UI only for enabled types.
if (translation_entity_enabled($entity_type)) {
$path = $info['menu_base_path'];
$entity_position = count(explode('/', $path)) - 1;
$keys = array_flip(array(
'theme_callback',
'theme_arguments',
'access_callback',
'access_arguments',
'load_arguments',
));
$menu_info = array_intersect_key($info['translation']['translation_entity'], $keys) + array(
'file' => 'translation_entity.pages.inc',
);
$item = array();
// Plugin annotations cannot contain spaces, thus we need to restore them
// from underscores.
foreach ($menu_info as $key => $value) {
$item[str_replace('_', ' ', $key)] = $value;
}
$items["{$path}/translations"] = array(
'title' => 'Translations',
'page callback' => 'translation_entity_overview',
'page arguments' => array(
$entity_position,
),
'type' => MENU_LOCAL_TASK,
'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
'weight' => 2,
) + $item;
// Add translation callback.
// @todo Add the access callback instead of replacing it as soon as the
// routing system supports multiple callbacks.
$add_path = "{$path}/translations/add/%language/%language";
$language_position = $entity_position + 3;
$args = array(
$entity_position,
$language_position,
$language_position + 1,
);
$items[$add_path] = array(
'title' => 'Add',
'page callback' => 'translation_entity_add_page',
'page arguments' => $args,
'access callback' => 'translation_entity_add_access',
'access arguments' => $args,
) + $item;
// Delete translation callback.
$items["{$path}/translations/delete/%language"] = array(
'title' => 'Delete',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'translation_entity_delete_confirm',
$entity_position,
$language_position,
),
) + $item;
}
}
$items['admin/config/regional/translation_entity/translatable/%'] = array(
'title' => 'Confirm change in translatability.',
'description' => 'Confirm page for changing field translatability.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'translation_entity_translatable_form',
5,
),
'access arguments' => array(
'toggle field translatability',
),
'file' => 'translation_entity.admin.inc',
);
return $items;
}