Search code examples
jsfliferay-6

Liferay: Render portlet contents differently based on view mode


I'd like to have different contents displayed when a portlet is in "normal mode" as opposed to "maximized mode". I'm using JSF as the view technology. Is there a check I can perform on the JSF end to check which view is currently being used?


Solution

  • Digging around on my own, I found out that #{request.windowState} gives you normal, maximized or minimized based on current view. Using this, there can be multiple solutions:

    1. Do a #{request.windowState == 'normal'} check and conditionally display content.

    2. Use <ui:include src="#{request.windowState}.xhtml" /> in my main view and then create normal.xhtml and maximized.xhtml ui:composition files.