Skip to main content
added 179 characters in body
Source Link

If you use entity translation and the node is attached to different menus, here is aan adaptation of the code that worksfilters on the current language. You need to copy this as PHP code for the contextual filter (parent menu link id) in your view like explained in the other answers

 if (function_exists('menu_node_get_links')) {
global $language;
$lang = $language->language;
$node = node_load(intval(arg(1)));
if (isset($node->menu_node_links)) {
  foreach ($node->menu_node_links as $mlid => $data) {  
    if ($lang == $data->language) {
      return($mlid);
    }
  }
}
  }

If you use entity translation and the node is attached to different menus here is a code that works

 if (function_exists('menu_node_get_links')) {
global $language;
$lang = $language->language;
$node = node_load(intval(arg(1)));
if (isset($node->menu_node_links)) {
  foreach ($node->menu_node_links as $mlid => $data) {  
    if ($lang == $data->language) {
      return($mlid);
    }
  }
}
  }

If you use entity translation and the node is attached to different menus, here is an adaptation of the code that filters on the current language. You need to copy this as PHP code for the contextual filter (parent menu link id) in your view like explained in the other answers

 if (function_exists('menu_node_get_links')) {
global $language;
$lang = $language->language;
$node = node_load(intval(arg(1)));
if (isset($node->menu_node_links)) {
  foreach ($node->menu_node_links as $mlid => $data) {  
    if ($lang == $data->language) {
      return($mlid);
    }
  }
}
  }
added 4 characters in body
Source Link
Krishna Mohan
  • 6.3k
  • 9
  • 30
  • 55

If you use entity translation and the node is attached to different menus here is a code that works

 if (function_exists('menu_node_get_links')) {
global $language;
$lang = $language->language;
$node = node_load(intval(arg(1)));
if (isset($node->menu_node_links)) {
  foreach ($node->menu_node_links as $mlid => $data) {  
    if ($lang == $data->language) {
      return($mlid);
    }
  }
}
  }

}

If you use entity translation and the node is attached to different menus here is a code that works

 if (function_exists('menu_node_get_links')) {
global $language;
$lang = $language->language;
$node = node_load(intval(arg(1)));
if (isset($node->menu_node_links)) {
  foreach ($node->menu_node_links as $mlid => $data) {  
    if ($lang == $data->language) {
      return($mlid);
    }
  }
}

}

If you use entity translation and the node is attached to different menus here is a code that works

 if (function_exists('menu_node_get_links')) {
global $language;
$lang = $language->language;
$node = node_load(intval(arg(1)));
if (isset($node->menu_node_links)) {
  foreach ($node->menu_node_links as $mlid => $data) {  
    if ($lang == $data->language) {
      return($mlid);
    }
  }
}
  }
deleted 2 characters in body
Source Link

If you use entity translation and the node is attached to different menus here is a code that works

 if (function_exists('menu_node_get_links')) {
global $language;
$lang = $language->language;
$node = node_load(intval(4arg(1)));
if (isset($node->menu_node_links)) {
  foreach ($node->menu_node_links as $mlid => $data) {  
    if ($mlid->language$lang == $data->lang>language) {
      return($mlid);
    }
  }
}
  }

}

If you use entity translation and the node is attached to different menus here is a code that works

if (function_exists('menu_node_get_links')) {
global $language;
$lang = $language->language;
$node = node_load(intval(4));
if (isset($node->menu_node_links)) {
  foreach ($node->menu_node_links as $mlid => $data) {
    if ($mlid->language == $data->lang) {
      return($mlid);
    }
  }
}
  }

If you use entity translation and the node is attached to different menus here is a code that works

 if (function_exists('menu_node_get_links')) {
global $language;
$lang = $language->language;
$node = node_load(intval(arg(1)));
if (isset($node->menu_node_links)) {
  foreach ($node->menu_node_links as $mlid => $data) {  
    if ($lang == $data->language) {
      return($mlid);
    }
  }
}

}

added 4 characters in body
Source Link
Krishna Mohan
  • 6.3k
  • 9
  • 30
  • 55
Loading
Source Link
Loading