Get all portlets placed on a page (layout)

To get all portlets placed on a page (layout) you can use the following lines of code:

import com.liferay.portal.model.LayoutTypePortlet;
import com.liferay.portal.model.Portlet;

LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) l.getLayoutType();
List< Portlet > portlets = layoutTypePortlet.getAllPortlets();

Leave a Reply