Java tutorial: Add Portlet to Liferay Control Panel

You can add portlet to liferay control panel. For your custom control panel portlet you have to modify liferay-portlet.xml file and add 2 lines there:

<control-panel-entry-category>portal</control-panel-entry-category>
<control-panel-entry-weight>1.0</control-panel-entry-weight>

The control-panel-entry-category has to be one of “my”, “content”, “portal” or “server” and specifies under which category should the portlet be displayed.
The weight specifies the ordering or the elements under the different categories. It’s a double number, and the higher you specify the lower your portlet is placed. So if you want to appear in the bottom, add “99.0”.
The portlet has to be non-instanceable (the Control Panel may have only such portlets) so you also have to have this line:

<instanceable>false</instanceable>

Please note that Control Panel by default does not allow you to enter CONFIG mode of the portlet. For a work-around you can use

<preferences-unique-per-layout>false</preferences-unique-per-layout>

Full example liferay-portlet.xml

<portlet>
 <portlet-name>hello-world-portlet</portlet-name>
 <icon>/icon.png</icon>
 <control-panel-entry-category>portal</control-panel-entry-category>
 <control-panel-entry-weight>99.0</control-panel-entry-weight>
 <action-url-redirect>true</action-url-redirect>
 <instanceable>false</instanceable>
 <preferences-unique-per-layout>false</preferences-unique-per-layout>
</portlet>

add portlet to liferay control panel

About Reigo Reinmets

Enterprise Software consultant with 9 years of experience in enterprise software world who's working on various projects that are mostly based on Liferay. Most blog posts here are real-life findings and issues we've encountered while working on projects and Java tutorials on Liferay.

Leave a Reply

Your email address will not be published. Required fields are marked *