Foren
Link to asset publisher from custom portlet
Simon Haidenbauer, geändert vor 10 Jahren.
Link to asset publisher from custom portlet
New Member Beiträge: 6 Beitrittsdatum: 07.04.11 Neueste Beiträge
Hello,
I'm looking for a way to generate a link to an asset publisher from my custom portlet. The asset publisher shall display a journal article. I have the articleId/assetId in my portlet but can't find a way to generate a correct link. If it's possible the link should be a friendlyURL and should work from the same page and from a completely different page.
I've googled and searched for a solution in this forum but either it's too easy or no one else has tried this before (though I can't quite believe that).
I'd greatly appreciate help on this,
kind regards,
Simon
I'm looking for a way to generate a link to an asset publisher from my custom portlet. The asset publisher shall display a journal article. I have the articleId/assetId in my portlet but can't find a way to generate a correct link. If it's possible the link should be a friendlyURL and should work from the same page and from a completely different page.
I've googled and searched for a solution in this forum but either it's too easy or no one else has tried this before (though I can't quite believe that).
I'd greatly appreciate help on this,
kind regards,
Simon
Jose Jiménez, geändert vor 10 Jahren.
RE: Link to asset publisher from custom portlet
Regular Member Beiträge: 176 Beitrittsdatum: 23.08.12 Neueste Beiträge
Hi Simon,
You can use the deffined friendlyURLs for the Asset Publisher, take a look about supported format & params:
https://github.com/liferay/liferay-portal/blob/master/portal-impl/src/com/liferay/portlet/assetpublisher/asset-publisher-friendly-url-routes.xml
Regards,
Jose
You can use the deffined friendlyURLs for the Asset Publisher, take a look about supported format & params:
https://github.com/liferay/liferay-portal/blob/master/portal-impl/src/com/liferay/portlet/assetpublisher/asset-publisher-friendly-url-routes.xml
Regards,
Jose
Juan Gonzalez, geändert vor 10 Jahren.
RE: Link to asset publisher from custom portlet
Liferay Legend Beiträge: 3089 Beitrittsdatum: 28.10.08 Neueste Beiträge
In addition to what Jose said, here is a method used for that purpose (6.1.2 GA3). You just have to get the article by its id:
https://github.com/liferay/liferay-portal/blob/6.1.2-ga3/portal-impl/src/com/liferay/portlet/journal/asset/JournalArticleAssetRenderer.java#L171
Probably you won't need all that lines of code.
https://github.com/liferay/liferay-portal/blob/6.1.2-ga3/portal-impl/src/com/liferay/portlet/journal/asset/JournalArticleAssetRenderer.java#L171
Probably you won't need all that lines of code.
Simon Haidenbauer, geändert vor 10 Jahren.
RE: Link to asset publisher from custom portlet
New Member Beiträge: 6 Beitrittsdatum: 07.04.11 Neueste Beiträge
Thank you both,
I've already found a solution by setting the display page of the article(s) and using
That way I get the correct URL to display the article in the default asset publisher of the page.
I've already found a solution by setting the display page of the article(s) and using
assetRenderer.getURLViewInContext(liferayPortletRequest, liferayPortletResponse, PortalUtil.getCurrentURL(request))
That way I get the correct URL to display the article in the default asset publisher of the page.
Jose Jiménez, geändert vor 10 Jahren.
RE: Link to asset publisher from custom portlet
Regular Member Beiträge: 176 Beitrittsdatum: 23.08.12 Neueste Beiträge
Nice, this is a good option.
Jose
Jose