We're using Menu Node API in combination with Node Symlinks. The problem is, that Menu Node API // Menu Node API Views does not work correctly if both modules are in use.

The problem is, that the menu_node table then contains several links for the given nid, for example:
nid | mlid
13 | 3746
13 | 3776
13 | 3777
13 | 3778

Now when the query is built, it's the following, when using the Menu: Node ID Reference:

SELECT node.nid AS nid, node.title AS node_title, node.language AS node_language, node.sticky AS node_sticky, menu_links.weight AS menu_links_weight, 'node' AS field_data_field_titelbild_node_entity_type, 'node' AS field_data_body_node_entity_type
FROM 
{node} node
LEFT JOIN {menu_node} menu_node ON node.nid = menu_node.nid
LEFT JOIN {menu_links} menu_links ON menu_node.mlid = menu_links.mlid
WHERE (( (menu_links.p1 = '3746') AND (menu_links.depth > '1') AND (menu_links.depth <= '2') AND (menu_links.p1 = '3876') AND (menu_links.depth > '1') AND (menu_links.depth <= '3') AND (menu_links.p1 = '3877') AND (menu_links.depth > '1') AND (menu_links.depth <= '4') AND (menu_links.p1 = '3878') AND (menu_links.depth > '1') AND (menu_links.depth <= '5') )AND(( (node.status = '1') )))
ORDER BY node_sticky DESC, menu_links_weight ASC
LIMIT 10 OFFSET 0

As you can see the WHERE connects all conditions by AND, which only displays nodes that are under ALL menu items. This doesn't seem to be practical and I think an OR would make more sense if there are several mlids for one node. The result is always empty for nodes that use menu symlinks.

Please let's discuss.
As workaround I will try to determine the mlid of the currently open node and use another reference.

Comments

Anybody’s picture

Workaround: Use views argument: "Menu: Parent menu link id" and provide this php snippet as fallback code:

// #webksde#JP2013-11-06 Use active trail because menu symlinks adds several mlids which menu_node_views can not handle directly (see https://drupal.org/node/2128827)
$active_trail = menu_get_active_trail();
if(!empty($active_trail)){
  $current = end($active_trail);
  if(!empty($current) && !empty($current['mlid'])){
      return $current['mlid'];
  }    
}

It ensures that only the mlid of the currently active menu item is used.

gabriel.achille’s picture

Status: Active » Closed (duplicate)