Foren

Programatically retrieve the list of available portlets

Ratheesh Vijayakumaran Nair, geändert vor 11 Jahren.

Programatically retrieve the list of available portlets

New Member Beiträge: 19 Beitrittsdatum: 31.05.12 Neueste Beiträge
I have a requirement to allow the user to pick the portlets that he wants to see in a page. The idea is to create an application for the user and allow them to select a layout and the available portlets to be dragged into the layout area and make that as his custom page. So if the user accesses that custom page, I should display the portlet application that he chose in the layout he chose. I was able to get the list of available layout by using the List<LayoutTemplate> layoutTemplates = LayoutTemplateLocalServiceUtil.getLayoutTemplates(); I would like to know if there is a similar way to retrieve the list of available portlets so that can be shown as a list for the user to select to be added to his custom page. Is there a way to programmatically retrieve it?

Thanks
Ratheesh
thumbnail
Christianto Sahat, geändert vor 11 Jahren.

RE: Programatically retrieve the list of available portlets

Regular Member Beiträge: 179 Beitrittsdatum: 25.09.07 Neueste Beiträge
You can use PortletLocalServiceUtil.getPortlets() to display all the portlets inside the portal.

But I believe you don't want to display system portlet into the users. In that case you can use


    PortletLocalServiceUtil.getPortlets(long companyId, boolean showSystem, boolean showPortal) 
   

set showSystem and showPortal to false
Ratheesh Vijayakumaran Nair, geändert vor 11 Jahren.

RE: Programatically retrieve the list of available portlets

New Member Beiträge: 19 Beitrittsdatum: 31.05.12 Neueste Beiträge
Thanks a lot, I'll try that.