Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • setting portlet preferences from portlet controller in liferay

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 720
    Comment on it

    Hello Guys

    Portlet preferences is use for layout setup in liferay. Here, We have setup layout from controller of the custom portlet in liferay.

    Follow the below steps to setup layout:

    Step 1: add below lines in Liferay-portlet.xml

    <preferences-unique-per-layout>false</preferences-unique-per-layout>
    <preferences-owned-by-group>true</preferences-owned-by-group>
    <instanceable>false</instanceable>
    

    Step 2: portlet.xml setting:

    <portlet-preferences>
    <preference>
    <name>portletSetupShowBorders</name>
    <value>false</value>
    </preference>
    </portlet-preferences>
    

    Step 3 : put below code in controller

    public PortletPreferences getStrictLayoutPortletSetup(Layout layout, String portletId) {
    
        long ownerId = PortletKeys.PREFS_OWNER_ID_DEFAULT;
        int ownerType = PortletKeys.PREFS_OWNER_TYPE_LAYOUT;
    
        if (PortletConstants.hasUserId(portletId)) {
            ownerId = PortletConstants.getUserId(portletId);
            ownerType = PortletKeys.PREFS_OWNER_TYPE_USER;
        }
    //.........
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: