掲示板

Get AssetPublisher Instance ID from a portlet in another page

11年前 に Maximiliano Chiesa によって更新されました。

Get AssetPublisher Instance ID from a portlet in another page

Junior Member 投稿: 47 参加年月日: 12/07/20 最新の投稿
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
11年前 に Harish Kumar によって更新されました。

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

Expert 投稿: 483 参加年月日: 10/07/31 最新の投稿
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
11年前 に Lionel Ferrer によって更新されました。

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

Junior Member 投稿: 42 参加年月日: 12/08/03 最新の投稿
what LifeRay version are you working on?