Liferay provided many customizations under the control panel. We can add our own portlet in the Liferay control panel. Here you will learn about how we can add a custom portlet into the Liferay control panel.

Prerequisites

  • Java 
  • Liferay portal 7/7.x

Environment Requirement

  • JDK 8
  • Eclipse
  • Liferay Portal

Follow below step for add portlet in control panel


1. Create MVC portlet

  1. Go to Liferay workspace project modules new.
  2. Select other Liferay Liferay Module Project and click on “Next”.
  3. Enter the project name.
  4. Select “Project Template Name” as “mvc-portlet” and click on “Next”.
  5. Enter a Package name and click on “Finish”. The necessary file structure for the MVC module will get created as below.
Add custom portlet into control panel in Liferay 7.2
 Add the below property in the Portlet class 

2. Implement your constants class

Add below code in your constants class.

3. Add Dependency

Add below line in “build.gradle” of your new MVCPortlet.

compileOnly group: “com.liferay”,name:”com.liferay.application.list.api”

4. Create your panel app component class

This class must extend the BasePanelApp Class and declare it as a service using service = PanelApp.class.

Lets understand following

panel.category.key” defines the category which is “control_panel.users” in our case. So our Student portlet will be added under “Users” section in control panel.

panel.app.order” defines the portlet position in the portlet list under “Users” section in control panel.

Now your necessary file structure will get created as below.
Add custom portlet into control panel in Liferay 7.2

5. Deploy your module and  you can see your module in the Liferay control panel

Add custom portlet into control panel in Liferay 7.2