Last active
January 11, 2022 16:54
-
-
Save epgarcia/1af5ee795033ab010926d9b24e166ea8 to your computer and use it in GitHub Desktop.
Freemarker sample to iterate the portletPreferences variable on a Liferay Application Display Template
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
<#-- | |
portletPreferences: Represents the preferences of the application that are used to display content | |
through this template. Use the map API of the selected template language to get the values of the | |
preferences. | |
--> | |
<#if portletPreferences?has_content> | |
<h1>Portlet Preferences</h1> | |
<ul> | |
<#list portletPreferences?keys as key> | |
<#assign values = portletPreferences[key] /> | |
<#if values?has_content> | |
<li>${key}: | |
<ul> | |
<#list values as value> | |
<li>${value}</li> | |
</#list> | |
</ul> | |
</li> | |
</#if> | |
</#list> | |
</ul> | |
</#if> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This doesn't work due to freemarker.template.TemplateModelException: Getting the number of items or enumerating the items is not supported on this method+sequence (wrapper: f.e.b.SimpleMethodModel) value.
Edit
Ye,
portletPreferences?keys
returns a map of class members...