-
-
Save gabrielke/2830993 to your computer and use it in GitHub Desktop.
User List 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
## Get the reference of DDL Record Service via serviceLocator, which is automatically set in the context | |
#set ($ddlRecordService = $serviceLocator.findService('com.liferay.portlet.dynamicdatalists.service.DDLRecordLocalService')) | |
## $reserved_record_set_id is also an object set in the context and it has the value of the list id configured for the portlet instance | |
#set ($recordSetId = $getterUtil.getInteger($reserved_record_set_id.data, 0)) | |
## call to the retrieve all records of the list | |
#set ($records = $ddlRecordService.getRecords($recordSetId)) | |
#foreach($record in $records) | |
## each record has a collection of fields (name and avatar in our case) | |
#set ($fields = $record.getFields()) | |
#set ($nameField = $fields.get("name")) | |
#set ($avatarField = $fields.get("avatar")) | |
## the avatar is a file upload field and its value holds a JSON object | |
## jsonFactoryUtil help us to convert string value into a JSON object | |
#set ($avatarJSONObject = $jsonFactoryUtil.createJSONObject($avatarField.value)) | |
#set ($fileName = $avatarField.getName()) | |
#set ($className = $avatarJSONObject.getString("className")) | |
#set ($classPK = $avatarJSONObject.getString("classPK")) | |
<div style="padding-top: 10px;"> | |
<img height="100" src='/documents/ddm/${className}/${classPK}/${fileName}' width="100" /> | |
<span style="padding-left: 5px;"> | |
$nameField.getValue() | |
<span> | |
</div> | |
#end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment