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