You are here

function _i18n_menu_link_process in Internationalization 7

Check whether this link is to be processed by i18n_menu and start processing.

2 calls to _i18n_menu_link_process()
i18n_menu_localize_tree in i18n_menu/i18n_menu.module
Localize menu tree.
i18n_menu_translated_menu_link_alter in i18n_menu/i18n_menu.module
Implements hook_translated_menu_link_alter().

File

i18n_menu/i18n_menu.module, line 535
Internationalization (i18n) submodule: Menu translation.

Code

function _i18n_menu_link_process(&$link) {

  // Only links that have a language property and haven't been processed before.
  // We also translate links marked as hidden because core breadcrumbs ignore
  // that flag and excluding them would basically interfere with core behaviour.
  // We also check that they belong to a menu with language options.
  if (empty($link['i18n_menu']) && !empty($link['language']) && !empty($link['access']) && i18n_menu_mode($link['menu_name'])) {

    // Mark so it won't be processed twice.
    $link['i18n_menu'] = TRUE;

    // Skip if administering this menu or this menu item.
    if (arg(0) == 'admin' && arg(1) == 'structure' && arg(2) == 'menu') {
      if (arg(3) == 'manage' && $link['menu_name'] == arg(4)) {
        return FALSE;
      }
      elseif (arg(3) == 'item' && arg(4) == $link['mlid']) {
        return FALSE;
      }
    }
    elseif (arg(0) == 'node' && arg(2) == 'edit' && $link['link_path'] == arg(0) . '/' . arg(1)) {
      return FALSE;
    }
    return TRUE;
  }
  else {
    return FALSE;
  }
}