Last active
March 21, 2022 21:53
-
-
Save marcosblandim/2a514a826989655d63ef88f7efb697b8 to your computer and use it in GitHub Desktop.
LIFERAY: Get the Display Page's Asset inside a Freemarker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#assign assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService")/> | |
<#if Request.INFO_ITEM_DETAILS??> | |
<#assign | |
info_item_reference = Request.INFO_ITEM_DETAILS.getInfoItemReference() | |
className = info_item_reference.getClassName() | |
classPK = info_item_reference.getClassPK() | |
asset = assetEntryLocalService.getEntry(className, classPK) | |
/> | |
${asset} | |
</#if> | |
* Works on Liferay 7.3+. | |
* Your Freemarker can be a Fragment, Widget Template, Web Content Template, etc; just make sure to use Freemarker's alternative square bracket syntax when inside a Fragment. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment