You are here

function lingotek_menu_link_update in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.7 lingotek.module \lingotek_menu_link_update()
  2. 7.6 lingotek.module \lingotek_menu_link_update()

Implements hook_menu_link_update().

Update the menu link's language to be language neutral, if desired, otherwise set it to be the same as it's node.

1 call to lingotek_menu_link_update()
lingotek_menu_link_insert in ./lingotek.module
Implements hook_menu_link_insert().

File

./lingotek.module, line 2318

Code

function lingotek_menu_link_update($link) {
  if (lingotek_translate_menu_link($link)) {
    lingotek_set_menu_link_language($link['mlid'], LANGUAGE_NONE);
  }
  else {
    if (!strstr($link['link_path'], '/')) {

      // No link language to set!
      return;
    }
    list($path, $node_id) = explode('/', $link['link_path']);
    if ($node_id && (int) $node_id) {

      // Get the node's language.
      $node = node_load($node_id);
      lingotek_set_menu_link_language($link['mlid'], $node->language);
    }
  }
}