Wednesday, 15 July 2015

How to display liferay portlet under custom category in add more option

Many a times it is the requirement that we want to see our custom portlet under specific category inside "Add More" option. In liferay it is possible to achieve the same by following simple steps.

Here are the three simple steps available to get it done:

1) Modify liferay-display.xml file to alter category details
2) Add an entry inside "Language.properties" for the new category
3) Run and Verify

Here are the steps in detailed:

1) Modify liferay-display.xml file to alter category details

<display>
        <category name="category.university">
                 <portlet id="studentPortlet" />
          </category>
</display>

Here we have taken an example of "University" which is the category name under which all our custom portlet related to "University" will be placed.

"category.university" is the name of the key which we will be placing inside "Language.properties"

2) Add an entry inside "Language.properties" for the new category

We need to create a "Language.properties" file which will maintain all the key and value pair.

In our case we need to add below line inside this file:

category.university=University

Here "category.university" is the key whose corresponding value i.e. "University" will be shown inside "Add More" option.

3) Run and Verify

Once above configuration is done we are almost done. Just need to build and redeploy our portlet. After we see message inside log file that our portlet is available for use we need to click on the "Add More" option and see the newly added category called "University" would be available. Under "University" you will see the portlet added under it. In our case its "studentPortlet".

Cheers!
Henal Saraiya
(Lead Consultant)
CIGNEX Datamatics

No comments:

Post a Comment