Migrated FTL function lib for file attachments

Jens Pelzetter 2019-12-21 18:56:15 +01:00
parent 5ce509dad7
commit a6569fb35c
2 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,29 @@
<#--filedoc
Functions for processing file attachments.
@depcrecated Use ccm-cms/file-attachments.ftl
-->
<#import "/ccm-cms/file-attachments" as FileAttachments>
<#--doc
Gets the file attachements of an content item.
@param item The content item providing the file attachments.
@return A sequence of the file attachments
-->
<#function getFileAttachments item>
<#return FileAttachments.getFileAttachments(item)>
</#function>
<#--doc
*Internal* function for determing the type of a file attachment.
@param file The file attachment.
@return The type the file. Either `caption` or `file`.
-->
<#function _getFileType file>
<#return FileAttachments._getFileType(file)>
</#function>

View File

@ -0,0 +1,41 @@
<#--filedoc
Functions for processing file attachments.
-->
<#--doc
Gets the file attachements of an content item.
@param item The content item providing the file attachments.
@return A sorted sequence of hashes (see Freemarker documentation) containing
the data the file attachments. The following keys are available:
* `fileType`: Type of the attachments. Either `file` or `caption`
* `mimeType`: The mime type of the file.
* `mimeTypeLabel`: A human readable label for the mime type.
* `fileSize`: The size of the file.
* `fileExtension`: The extension part of the file name.
* `fileId`: The ID of the file.
* `fileName`: The name of the file.
* `description`: The description of the file attachment.
* `fileUrl`: The URL for downloading the file.
* `fileOrder`: The value of the order property of the file attachment.
-->
<#function getFileAttachments item>
<#return item.fileAttachments>
</#function>
<#--doc
*Internal* function for determing the type of a file attachment.
@param file The file attachment.
@depcrecated without replacement.
@return The type the file. Starting with version 7.0.0 always `file`.
-->
<#function _getFileType file>
<#return "file">
</#function>