You are here

function i18n_menu_link_load in Internationalization 7

Load menu item by path, language

1 call to i18n_menu_link_load()
i18n_menu_i18n_translate_path in i18n_menu/i18n_menu.module
Implements hook_i18n_translate_path()

File

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

Code

function i18n_menu_link_load($path, $langcode) {
  $query = db_select('menu_links', 'ml');
  $query
    ->leftJoin('menu_router', 'm', 'm.path = ml.router_path');
  $query
    ->fields('ml');

  // Weight should be taken from {menu_links}, not {menu_router}.
  $query
    ->addField('ml', 'weight', 'link_weight');
  $query
    ->fields('m');
  $query
    ->condition('ml.link_path', $path);
  $query
    ->condition('ml.language', $langcode);
  if ($item = $query
    ->execute()
    ->fetchAssoc()) {
    $item['weight'] = $item['link_weight'];
    _menu_link_translate($item);
    return $item;
  }
}