Thursday 10 December 2020

Changes are Enabling serviceLocator Calls in Liferay DXP

 Working with FreeMarker Template using to fetch the AssetVocabulary and Categories web content template.

  1.  Remove the restricted variables in Control Panel -> System Settings -> Free Marker
  2. Remove serviceLocator and staticUtils

<#assign AssetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService")>
<#assign AssetVocabularyLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetVocabularyLocalService")>
<#assign listVecoblaries = AssetVocabularyLocalService.getGroupVocabularies(themeDisplay.getSiteGroupId())>
<#if listVecoblaries?has_content>
<#list listVecoblaries as vecobulary>
<#assign countoftotal = AssetCategoryLocalService.getVocabularyRootCategoriesCount(vecobulary.getVocabularyId())>
<#assign listVecoblaryCategories = AssetCategoryLocalService.getVocabularyRootCategories(vecobulary.getVocabularyId(), 0, countoftotal , null)>
<#if listVecoblaryCategories?has_content>
<#list listVecoblaryCategories as category>
${category.getName()}
</#list>
</#if>
</#list>
</#if>


No comments:

Post a Comment

  Inter Portlet Communication (IPC) in Liferay 7.4 Public Render Parameter IPC: 1) Create a new module project -> SenderPortlet 2) In  Se...