Working with FreeMarker Template using to fetch the AssetVocabulary and Categories web content template.
- Remove the restricted variables in Control Panel -> System Settings -> Free Marker
- 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