You are here

function i18n_menu_node_presave in Internationalization 7

Implements hook_node_presave()

Set menu link language to node language

File

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

Code

function i18n_menu_node_presave($node) {
  if (!empty($node->menu) && isset($node->language) && i18n_menu_node_supported_type($node->type)) {
    $node->menu['language'] = i18n_object_langcode($node, LANGUAGE_NONE);

    // Store node type with menu item so we can quickly access it later.
    $node->menu['options']['node_type'] = $node->type;
  }
}