开发者

How do i check whether a node is a child of another node (Drupal 7)

I'm iterating over an array of nids. 开发者_StackOverflow社区Now I need to check whether the current nid is a child (in the menu) of the current menu object. But i could find any method to get all children of a node by nid. (something like menu_get_children($nid);)

Has anyone an idea how to do that? (quick and dirty is allowed)


I don't think there is an easy way to do that. Nodes do not form a hierarchy (Unless you are using the book.module), there is no real connection between menu links and nodes.

When you look at http://api.drupal.org/api/drupal/modules--menu--menu.module/function/menu_node_prepare/7, the only way to get the menu link belonging to a node is to look for a menu link with the path "node/nid".

You could try to do the same thing and then get the menu childrens of that, then again check if they point to a node and extract the nid from the link_path.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜