Control Panel Portlet:Move a Portlet to Control Panel

making-liferay-control-panel-portlet


aim

As a Liferay Portal developer we know whats Control Panel. Sometimes we need to develop a portlet which should be only available in the Control Panel but not in other places. In this article we will show how to move a custom built portlet to the control panel.


We will try to convert or move our portlet to Control Panel which is already developed

convert-portlet-to-control-panel-portlet

Below are the 2 files we need to modify to make a Control Panel Portlet

i) liferay-portlet.xml

&

ii) liferay-display.xml

Follow the below steps to make existing portlet to available in Control Panel Portlet

Step 1:Specify where the portlet will appear in Control Panel

Open your liferay-portlet.xml. Add the below tags after <icon> tag


<control-panel-entry-category>apps</control-panel-entry-category>
<control-panel-entry-weight>0</control-panel-entry-weight>

Note 1: In the above code the line <control-panel-entry-category>apps</control-panel-entry-category> says where our portlet will appear in the Contro Panel.

According to DTD below is the explanation

Set the control-panel-entry-category value to “my” to make this portlet available within the My Account administration of the user. Set the value to “apps”, “configuration”, “sites”, or “users” to make it available in the Control Panel under that category. Set the value to “site_administration.configuration”, “site_administration.content”, “site_administration.pages” or “site_administration.users” to make it available in the Site Administration under that category. Legacy values from previous versions of Liferay will be automatically mapped to the new values: “content” to “site_administration.content”, “portal” to “users”, and “server” to “apps”.

DTD Link: http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd

Note 2: The Tag <control-panel-entry-weight> represents location vertically in the given category. According to our code Book Portlet will appear at first position in apps category. 

control-panel-portlet-weight

Step 2:Make the portlet hidden

In this step we put the portlet in hidden category so that it’s not available anywhere other than Control Panel. This is done by modifying liferay-display.xml. For example 


<display>
<category name="category.hidden">
<portlet id="book-portlet" />
</category>
</display>

That’s all about making your portlet available in Control Panel.

Download Above Example:

book-portlet

About The Author

1 thought on “Control Panel Portlet:Move a Portlet to Control Panel”

  1. Hello, thanks for the post.

    How can modify the whole product menu? I am using liferay 7, and it says I should first create a GENERIC MODULE but I can’t find how to generate a GENERIC MODULE because using blade cli, doesn’t give me option of creating a generic module because it comes with templates.
    Please help.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top
%d