Hello,

I want to get all the parent (nids or mlids) of a menu item. Is there a function to retrieve these datas with the nid or mlid of the menu item?

Thanks for your help.

Comments

kumkum29’s picture

Hello,

with this function I get all parent mlids:

$path = 'node/'.$node->nid;

$mlid = db_select('menu_links' , 'ml')
->condition('ml.link_path' , $path)
->fields('ml' , array('mlid'))
->execute()
->fetchField();
			
$menuParents = token_menu_link_load_all_parents($mlid);
kumkum29’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

nelec’s picture

Hi,
this is the first snippet of its kind I was able to find after days but I am wondering:
is there a way to print the master parent mlid of any current page as a class attribute for my html elements?

Many thanks in advance for your answer