Developer forum

Forum » Development » Find name of menu that is being rendered in a MenuProvider

Find name of menu that is being rendered in a MenuProvider


Reply
Hi there,

Is there a way to determine which menu is rendered in a MenuProvider when using Designs and Layouts? It seems that

this.XmlNavigation.NavigationName

returns the name of the XSLT stylesheet (without the .xslt extension) which helps in determining which menu is being rendered.

However, I have a situation where I use the same XSLT at two different locations: the main menu and the footer. In the footer I would like to dynamically inject a few items, so I need a way to distinguish between the two menus.

Is this possible? Would be great if we could access the class name for example or if there was an option to specify some unique name in the settings attribute that was made available on the XmlNavigation item.

Kind regards,

Imar

Replies

 
Nicolai Høeg Pedersen
Reply
If you set the id in the settings, the XmlNavigation.NavigationName would contain the ID.

<ul class="DwNavigation" id="MyNavigation" settings="id:MyNavigation;" >

Just changed the API so if id is specified on the ul element that will be used instead of the name of the xslt. From 7.2.
 
Reply
Excellent. id:SomeName did do the trick.

With regard to the change you made, wouldn't that mean you lose the name of the XSLT style sheet? Or was it never meant to hold that in the first place (now that I think of it, you just get the name and not the full path, so it's probably useless anyway).

Thanks,

Imar
 
Nicolai Høeg Pedersen
Reply
The xslt name is a fallback. If no name is present, it searched for the id, and if that is not found it takes the name of the xslt.

We could add a property on the XMLNavigation for the template?

 

You must be logged in to post in the forum