1
votes

I am using Mobile Device Rules to set actions for different mobile devices. I have set two actions: 1. Change layout to one column and 2. Change theme to mobile theme displaying a block menu and the WebContent Display columns.

I need to hide portlets that are on the desktop version from the mobile version: ie. related asset portlet, ad portlets when viewing the page from a Mobile device. I need to accomplish this in the simplest way possible. Can the portlet configuration settings change to indicate whether they are displayed using a mobile device?

2
Portlet Configuration - Supported Clients will allow me to choose mobile devices if the portlet supports multiple mime types. How can I set this?Ursula

2 Answers

2
votes

Found a solution to my problem, with the help of Liferay support. Two possible ways of hiding portlets:

  1. Add a Custom Action to the Mobile Device Rules Plugin.
  2. Extend Liferay's rendering logic: Read the http attribute and determine wheter the browser is mobile and hide the portlets you need. For example, use a hook for render_portlet.jsp and customized using the following:

    if (BrowserSnifferUtil.isMobile(request)) { if("1_WAR_webformportlet_INSTANCE_qlQYswM4fJFO".equals(portletId)) { //example supportsMobile = false; } }

1
votes

One possibility is to hide your "related asset portlet" in the mobile theme. The disadvantage of this solution is that you trasfer markup that is not visible.

Other solution is to create a page for mobile devices, that doesn§t contain "related asset portlet". Then you create mobile rule that redirects user if he accesses original page from mobile device.