You are here

function i18ncontent_menu_alter in Internationalization 6

Implementation of hook_menu_alter().

Take over the node add pages.

File

i18ncontent/i18ncontent.module, line 161
Internationalization (i18n) package - translatable content type parameters

Code

function i18ncontent_menu_alter(&$menu) {
  $menu['node/add']['page callback'] = 'i18ncontent_node_add_page';
  if (variable_get('page_manager_node_edit_disabled', TRUE)) {

    // Replace node/add/* menu items
    foreach (node_get_types('types', NULL, TRUE) as $type) {
      $type_url_str = str_replace('_', '-', $type->type);
      $path = 'node/add/' . $type_url_str;
      if (!empty($menu[$path]['page callback']) && $menu[$path]['page callback'] == 'node_add') {
        $menu[$path]['page callback'] = 'i18ncontent_node_add';
        $menu[$path]['title callback'] = 'i18nstrings_title_callback';
        $menu[$path]['title arguments'] = array(
          'nodetype:type:' . $type->type . ':name',
          $type->name,
        );
      }
    }
  }
}