Defining the Configuration in setting
In Liferay Core portlets you can see the portlet in setting tab as
Add the following entry in the liferay-portlet.xml after icon tag as
<configuration-action-class>
com.liferay.portal.kernel.portlet.DefaultConfigurationAction
</configuration-action-class>
and define the following in the portlet.xml as
<init-param>
<name>config-template</name>
<value>/html/test/config.jsp</value>
</init-param>
In Config.jsp
If you want to save the entries in the preferences it is very simple
<liferay-portlet:actionURL var="configURL" portletConfiguration = "true"/>
<aui:form action="${configURL}">
1. <aui:input type="hidden" name="cmd" value="update"/>
2. <aui:input name="perferences--test--"/>
</aui:form>
Here 1 and 2nd steps are mandatory to save the preferences . but the name test can be anything.
These two steps are mandatory because if we look into the DefaultConfigurationAction class of processAction method it as follows
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest,
ActionResponse actionResponse) throws Exception {
-------------
---------------
}
Add the following entry in the liferay-portlet.xml after icon tag as
<configuration-action-class>
com.liferay.portal.kernel.portlet.DefaultConfigurationAction
</configuration-action-class>
and define the following in the portlet.xml as
<init-param>
<name>config-template</name>
<value>/html/test/config.jsp</value>
</init-param>
In Config.jsp
If you want to save the entries in the preferences it is very simple
<liferay-portlet:actionURL var="configURL" portletConfiguration = "true"/>
<aui:form action="${configURL}">
1. <aui:input type="hidden" name="cmd" value="update"/>
2. <aui:input name="perferences--test--"/>
</aui:form>
Here 1 and 2nd steps are mandatory to save the preferences . but the name test can be anything.
These two steps are mandatory because if we look into the DefaultConfigurationAction class of processAction method it as follows
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest,
ActionResponse actionResponse) throws Exception {
-------------
---------------
}
Can you tell me how to change the name of the tab.
ReplyDeleteFor example I want to change the name from "Setup" to "Places"
Hi Mitra,
DeleteDid you figure out the solution for it!! ?