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)