Determine Portlet IDs in Liferay

Sometimes you might need to dynamically determine the IDs of all portlets placed in certain pages. Here is how you can do it:

List<String> portletIdList = themeDisplay.getLayoutTypePortlet().getPortletIds();

for(String pid : portletIdList) {
	out.println(pid+"<br>");
}

That’s it!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.