You are here

function i18n_node_menu_alter in Internationalization 7

Implements hook_menu_alter().

Take over the node translation page.

File

i18n_node/i18n_node.module, line 138
Internationalization (i18n) module - Node type handling

Code

function i18n_node_menu_alter(&$items) {
  if (isset($items['node/%node/translate'])) {
    $items['node/%node/translate']['page callback'] = 'i18n_node_translation_overview';
    $items['node/%node/translate']['file'] = 'i18n_node.pages.inc';
    $items['node/%node/translate']['module'] = 'i18n_node';
  }

  // Take over node/add pages for string translation
  $items['node/add']['page callback'] = 'i18n_node_add_page';
  $items['node/add']['file'] = 'i18n_node.pages.inc';
  $items['node/add']['file path'] = drupal_get_path('module', 'i18n_node');

  // @TODO avoid iterating over every router path.
  foreach (node_type_get_types() as $type) {
    $path = 'node/add/' . str_replace('_', '-', $type->type);
    if (isset($items[$path])) {
      $items[$path]['title callback'] = 'i18n_node_type_name';
      $items[$path]['title arguments'] = array(
        $type->type,
        $type->name,
      );
    }
  }
}