Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find which menu a node belongs to in drupal

I currently have nodes setup on my site, and each node belongs to a particular menu (not primary or secondary prebuilt menues).

How can i find out which menu a node belongs to?

like image 902
Shadi Almosri Avatar asked Dec 17 '22 03:12

Shadi Almosri


1 Answers

Maybe this is what you mean:

$trail        = menu_get_active_trail();
$lastInTrail  = end($trail);
$menu_name    = $lastInTrail['menu_name'];

menu_get_active_trail() returns a breadcrumbs like array, the last breadcrumb represents the current node.

Cheers, Laurens Meurs, Rotterdam

like image 72
lmeurs Avatar answered Jan 14 '23 04:01

lmeurs