How to add section(category) in control panel

1. Override the class PortletCategoryKeys (in ext-impl\src\com\liferay\portal\util\PortletCategoryKeys.java)

1
2
3
4
5
6
7
8
9
10
11
12
13
package com.liferay.portal.util;
/**
  * @author apoorva.prakash
  *
  */
public class PortletCategoryKeys {
  public static final String CONTENT = "content" ;
  public static final String MY = "my" ;
  public static final String PORTAL = "portal" ;
  public static final String SERVER = "server" ;
  public static final String MYCATEGORY = "mycategory" ;
  public static final String[] ALL = {MY, CONTENT, MYCATEGORY , PORTAL, SERVER};
}

Put the category in ALL array in the order you wish to appear your category.

2. Now add portlet in this category using the following entry in liferay-portlet-ext.xml file

1
2
3
4
5
< portlet >
     < portlet-name >portlet_id</ portlet-name >
  < control-panel-entry-category >mycategory</ control-panel-entry-category >
  < control-panel-entry-weight >1</ control-panel-entry-weight >
</ portlet >

here  portlet_id is the id of the portlet that you wish to add in our custom category. Specify the name of the category in <control-panel-entry-category> entry and sequence of portlet appearance in determined through <control-panel-entry-weight>. The higher the weight, upper will be the portlet(weight can also be in floating number).

 

3. In portlet.xml file,  add role reference

<security-role-ref>
        <role-name>role-name</role-name>
</security-role-ref>

 

4. in liferay-portlet.xml add role mapper

<role-mapper>
    <role-name>role-name</role-name>
    <role-link>actual-role-name</role-link>
</role-mapper>


5. Now an important point, we must enter the category name entry in language-ext.properties file in ext-impl/src/content, so that our category can be recognized, otherwise you'll get category name as "category.mycategory"

1
category.mycategory=My New Category

That's all I did, hope will work for you too.

 

6.  In resources/resource-actions/default.xml write permission

<supports>
 <action-key>ACCESS_IN_CONTROL_PANEL</action-key>
 <action-key>VIEW</action-key>
</supports>

 

7. point to this file in resources/portlet.properties

resource.actions.configs=resource-actions/default.xml

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值