FROMDEV

How to Show the Minimize and Maximize button on Liferay 6.x Portlet for All Logged In Users

liferay 6.x portal default portlet configuration does not display minimize and maximize icons on portlet headers. These buttons are only available to admin role users. For one of our projects, we had to display the minimize and maximize button for all of our logged in users. We tried to do a lot of research and realized that there is no easy way of doing it in liferay 6.x portal. This post is about a simple workaround we have found which will start showing minimize and maximize icons on all liferay portlets including custom and out of the box portlets.

This workaround requires us to modify a liferay core JSP file. You need to carefully follow below steps to start displaying the minimize and maximize icons on all portlets. We are using a tomcat bundle for describing below steps, in case you are using a different bundle you may need to look for specific directories in respective bundles.

  1. Go to the directory liferay-portal-6.x/tomcat-xxx/webapps/ROOT/html/portal
  2. Open the file render_portlet.jsp
  3. Find below text line in the render_portlet.jsp file
  4. portletDisplay.recycle();
    
  5. Add below code snippet just above this line
  6. if (themeDisplay.isSignedIn()) 
    {         
    showMaxIcon = true;         
    showMinIcon = true; 
    } 
    

The if condition “themeDisplay.isSignedIn()” is going to verify if the user is logged in and display the minimize and maximize icons for all logged in users on all portlets. In case you want to show the minimize and maximize icons to all users including guests you can remove this if condition and replace it with below snippet

showMaxIcon = true;
showMinIcon = true;

We spent a lot of time finding out this workaround, hope this helps others. Let us know if you can think of a better approach to do the same thing.

Exit mobile version