我可以获得没有孩子的字段的值(在本例中名为 Field 的字段):
<#if imageMimeTypes?seq_contains(entry.getMimeType()) >
<#assign fileEntryType = DLFileEntryTypeService.getFileEntryType(fileEntryTypeId) />
<#assign dlFileVersion = DLFileVersionService.getLatestFileVersion(fileEntry.getUserId(), fileEntry.getFileEntryId()) />
<#assign fieldsMap = fileEntry.getFieldsMap(dlFileVersion.getFileVersionId()) />
<#list fieldsMap?keys as structureKey>
<#list fieldsMap[structureKey].iterator() as field>
<#if field.getName() == 'Field'>
<#assign Field = field.getValue() />
</#if>
</#list>
</#list>
Value: ${Field}
</#if>
但是当我有一个带有子字段的可重复字段时,我既不能获得可重复字段的值,也不能获得其子字段的值。
<#list fieldsMap?keys as structureKey>
<#list fieldsMap[structureKey].iterator() as field>
<#if field.getName() == 'Repeatable_field'>
<#assign RepeatableField = field.getName() />
</#if>
</#list>
</#list>
Value: ${RepeatableField}
我收到此错误:
在这里期待字符串,日期或数字,Expression RepeatableField 而是一个freemarker.template.SimpleSequence
更新
我设法使用 Repeatable_field
方法获取field.getValues(locale)
的值。
但我仍然无法获得其子女的价值:
<#list fieldsMap?keys as structureKey>
<#list fieldsMap[structureKey].iterator() as field>
<#if field.getName() == 'Repeatable_field'>
<#assign repeatableFieldValues = field.getValues(locale) />
<#list repeatableFieldValues as val>
<#assign Field = val /><#-- parent Value -->
<#-- assign childrenField = val.Children_field.getValue() --><#-- children Value -->
</#list>
</#if>
</#list>
</#list>