Fórumok

Get AssetPublisher Instance ID from a portlet in another page

Maximiliano Chiesa, módosítva 11 év-val korábban

Get AssetPublisher Instance ID from a portlet in another page

Junior Member Bejegyzések: 47 Csatlakozás dátuma: 2012.07.20. Legújabb bejegyzések
Hi!

I have a page with the Asset Publisher portlet in it and I want to obtain it's Instance ID from a portlet that is in another page (a portlet that I created)

I tried getting all the portlets with the PortletLocalServiceUtil class and iterate over these getting the instance id of each one but portlet instance id is always null :s

Is there another way of getting this instance id ?

Thanks in advance!
thumbnail
Harish Kumar, módosítva 11 év-val korábban

RE: Get AssetPublisher Instance ID from a portlet in another page

Expert Bejegyzések: 483 Csatlakozás dátuma: 2010.07.31. Legújabb bejegyzések
Hi Maximiliano,

you should know the column at least in which you have placed the asset publisher portlet on that page.

Here is code snippet you can use to fetch the portlet id -

String portletId="";

Layout articleLayout = LayoutLocalServiceUtil.getFriendlyURLLayout(assetRenderer.getGroupId(), false, "/pagename");
LayoutTypePortlet articleLayoutTypePortlet = (LayoutTypePortlet)articleLayout.getLayoutType();
List<Portlet> allPortlets = articleLayoutTypePortlet.getAllPortlets("column-1");
for (Portlet p: allPortlets)
{
if (PortletKeys.ASSET_PUBLISHER.equals(p.getRootPortletId()))
{
portletId = p.getInstanceId();
break;
}
}



HTH
Regards,
thumbnail
Lionel Ferrer, módosítva 11 év-val korábban

RE: Get AssetPublisher Instance ID from a portlet in another page

Junior Member Bejegyzések: 42 Csatlakozás dátuma: 2012.08.03. Legújabb bejegyzések
what LifeRay version are you working on?