user731060
user731060

Reputation: 47

Drupal Menu-How to get Hierarchy

In Drupal how can I get selected menu items hierarchy?

If I selected item3, how can I get the the entire hierarchy...(eg:item1->item2-item3)

If I use $menu_item = menu_get_item();, I will get active menu item name (eg: item3). But I want to get it like (item1->item2->item3).

Upvotes: 0

Views: 388

Answers (1)

Code Lღver
Code Lღver

Reputation: 15603

$parent = menu_get_item($vars['mid']);
$vars['parent'] = $parent['pid'];

$hasParent = menu_get_menu();
$hasParent = $hasParent['items'][$parent]['pid'];

this code will give you the parent menus information and you can print that.

Upvotes: 1

Related Questions