I'm trying to add a tab in the conf of my custom portlet, beside the natives import/export and permissions.
Like in this image : http://imageshack.us/photo/my-images/716/sampledn.png/
This tab had to allow, to change the value of a parameter in a conf.properties which define some variable.
How can I do that?
Regards.
Yup you can do it by first of all adding this to your portlet.xml as a child of the "portlet" node:
<init-param>
<name>config-jsp</name>
<value>/html/config.jsp</value>
</init-param>
The in your liferay-portlet.xml you need to add this as a child of the "portlet" node:
<configuration-action-class>com.yourportlet.action.ConfigurationActionImpl</configuration-action-class>
Then you need to create this files in the directories you've specified in your XML, and your ConfigurationActionImpl should implement the ConfigurationAction interface so the skeleton would look like this:
public class ConfigurationActionImpl implements ConfigurationAction {
@Override
public String render(PortletConfig config, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception {
return "/html/config.jsp";
}
Let me know if this helps or you have any other questions! :)
Add edit mode to your portlet.xml:
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode> <!-- add this line -->
</supports>
Then you will see preferences option in the menu. Override doEdit method in your portlet class to render content of the edit mode.
EDIT:
More advanced solution:
You can add another tab by changing portal jsp via hook. The jsp you need to change is:
/html/portlet/portlet_configuration/tabs1.jsp
Note that this will change configuration window for ALL portlets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With