Embed secondary navigation menu in Liferay theme

Elena Stefanova, modified 6 Years ago. Junior Member Posts: 42 Join Date: 8/24/15 Recent Posts

Hi, there!

I'm currently developing a new theme in Liferay 7.1.1-ga2. In this theme I need to show two navigation menus - primary and secondary. I already created these menus in my admin and now I'm trying to embed them in my theme. Unfortunatelly, I cannot set the correct menu type for the secondary menu. Nomatter what preferences I'm trying to pass I always see the primary navigation menu. The code that I use is the following:

&lt;#assign preferencesMap = {<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"displayDepth": "1",<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"selectSiteNavigationMenuType": "2"&nbsp; // -&gt; this is the matching type identifier<br> &nbsp;&nbsp; &nbsp;}<br> /&gt;<br> &lt;@liferay.navigation_menu<br> &nbsp;&nbsp; &nbsp;default_preferences=freeMarkerPortletPreferences.getPreferences(preferencesMap)<br> &nbsp;&nbsp; &nbsp;instance_id="secondary_navigation"<br> /&gt;

 

Am I doing something wrong or it is impossible to achieve what I need?

Any help will be appreciated!

Thanks in advance,

Eli

Patrick Yeo, modified 6 Years ago. Junior Member Posts: 61 Join Date: 2/8/13 Recent Posts

Hey Eli,

Instead of "selectSiteNavigationMenuType": "2" try using "siteNavigationMenuType": "2" . There is a quirk (feature or bug) with embedded portlets where once it's deployed the default_preferences can't be updated again on subsequent deploys. The only way to make changes apply is to delete the embedded portlet's preferences from the database. The way I would test changes to default_preferences is to change the instance_id every time I make a change and deploy.
Elena Stefanova, modified 6 Years ago. Junior Member Posts: 42 Join Date: 8/24/15 Recent Posts

Hi, Patrick!

Thank you so much for you quick answer! Your solution worked great for me smiley Following your advices I changed preference "selectSiteNavigationMenu" to "siteNavigationMenuType" as now I pass a different instance_id each time on deployment. Obviously this the correct approach.

Thank you once again!

Greetings,

Eli