How to add Custom Catagory in Liferay's Control Panel

blog-banner

In Liferay's Control Panel, we can see predefined categories such as Portal, Server, Marketplace etc.

Liferay provides functionality where one can also create his own custom category and add it in a Liferay's Control Panel. For this we need to first create an  ext-plugin  and also need to do some changes in  liferay-portlet.xml  of portlet which you want to add in custom category.

To do so, you need to follow below mentioned steps:

  • Create  ext-plugin  and override PortletCategoryKeys class of it. But make sure your path should be like docroot\WEB_INFext-impl\src\com\liferay\portal\util\PortletCategoryKeys.java.

    After that add following code in a class.

    For Liferay 6.x

    public class PortletCategoryKeys {
    
    public static final String[] ALL = {PortletCategoryKeys.MY,
    			PortletCategoryKeys.CONTENT, PortletCategoryKeys.PORTAL,
    			PortletCategoryKeys.SERVER,
    			PortletCategoryKeys.MY_CUSTOM_CATEGORY }; 
    
    public static final String CONTENT = "content";
    public static final String MARKETPLACE = "marketplace";
    public static final String MY = "my";
    public static final String PORTAL = "portal";
    public static final String SERVER = "server";
    public static final String MY_CUSTOM_CATEGORY = "my_custom_category"; 
    }
    

    For Liferay 6.1.x

    public class PortletCategoryKeys {
    
    public static final String[] ALL = { PortletCategoryKeys.MARKETPLACE,
    			PortletCategoryKeys.MY,
    			PortletCategoryKeys.CONTENT, PortletCategoryKeys.PORTAL,
    			PortletCategoryKeys.SERVER,
    			PortletCategoryKeys.MY_CUSTOM_CATEGORY };
    
    public static final String CONTENT = "content";
    public static final String MARKETPLACE = "marketplace";
    public static final String MY = "my";
    public static final String PORTAL = "portal";
    public static final String SERVER = "server";
    public static final String MY_CUSTOM_CATEGORY = "my_custom_category"; 
    }
    
    • Add Language-ext.properties file in a folder named content under “docroot\WEB_INFext-impl\src\’’ folder & add following line in it,

    category.my_custom_category=Surekha Technologies (this would be category name)

    • To add your portlet in that category add following code in liferay-portlet.xml in between  <portlet>  tag.

    <control-panel-entry-category>my_custom_category</control-panel-entry-category>

    <control-panel-entry-weight>1</control-panel-entry-weight>

    • Specify name of the category in  <control-panel-entry-category> .
    • Sequence of portlet in control panel will determined through  <control-panel-entry-weight> .

That's it. Once you restart your server, you will have your custom category display in Control Panel.

For more implementation details or support you may contact us at [email protected].

Contact us

For Your Business Requirements

: 0 / 65000

: 0 / 280

: 0 / 280

: 0 / 280

: 0 / 280

: 0 / 280

: 0 / 65000

Text to Identify Refresh CAPTCHA
Background Image Close Button

2 - 4 October 2024

Hall: 10, Booth: #B8 Brussels, Belgium