Foren

Get AssetPublisher Instance ID from a portlet in another page

Maximiliano Chiesa, geändert vor 11 Jahren.

Get AssetPublisher Instance ID from a portlet in another page

Junior Member Beiträge: 47 Beitrittsdatum: 20.07.12 Neueste Beiträge
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, geändert vor 11 Jahren.

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

Expert Beiträge: 483 Beitrittsdatum: 31.07.10 Neueste Beiträge
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, geändert vor 11 Jahren.

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

Junior Member Beiträge: 42 Beitrittsdatum: 03.08.12 Neueste Beiträge
what LifeRay version are you working on?