Blogs

Blogs

Embedding Navigation Portlet into Layout using Custom Settings

Special thanks to atul patel's forum post displays how to embed a navigation portlet into a layout using custom settings.
With Custom Settings Basic display styles: There are 6 different basic views (source wiki):

  1. looks like breadcrumbs; shows parent page and current page but not siblings
  2. current page only?
  3. shows parent page and all subpages (siblings). The current page is bold. This seems to be the most valuable normal setting.
  4. shows subpages (siblings), no parent
  5. ? looks like 4
  6. Is a full community/org nav. Shows all pages in tier
$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
$velocityPortletPreferences.setValue("root-layout-type", "absolute")
$velocityPortletPreferences.setValue("bullet-style", "main")
$velocityPortletPreferences.setValue("header-type", "none")
$velocityPortletPreferences.setValue("root-layout-level", "0")
$velocityPortletPreferences.setValue("included-layouts", "all")
$velocityPortletPreferences.setValue("display-style", "")
$theme.runtime("71_INSTANCE_MAIN", "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()

 

To embed it in a layout use the following code

#set ($VOID = $velocityPortletPreferences.setValue("portletSetupShowBorders", "false"))
#set ($VOID = $velocityPortletPreferences.setValue("rootLayoutType", "absolute"))
#set ($VOID = $velocityPortletPreferences.setValue("bulletStyle", ""))
#set ($VOID = $velocityPortletPreferences.setValue("headerType", "none"))
#set ($VOID = $velocityPortletPreferences.setValue("rootLayoutLevel", "1"))
#set ($VOID = $velocityPortletPreferences.setValue("includedLayouts", "auto"))
#set ($VOID = $velocityPortletPreferences.setValue("displayStyle", "[custom]"))
#set ($VOID = $velocityPortletPreferences.setValue("nestedChildren", "1"))
#set ($VOID = $theme.runtime("71_INSTANCE_MAIN", "", $velocityPortletPreferences.toString()))
#set ($VOID = $velocityPortletPreferences.reset())

Thanks to post (https://www.liferay.com/community/forums/-/message_boards/message/29205064)