File template functions

These template functions render files in a standardised manner.

All functions take optional options as string arguments. Options can be "asFullURL", "authenticationSignature", and "authenticationSignatureValidForSeconds" and "forceDownload", matching the meanings of the options for File’s toHTML() function.

Unlike toHTML(), this simplified interface means a validity time cannot be specified for "authenticationSignatureValidForSeconds". The validity time is set to several hours.

To render a file with a thumbnail and filename, use an authentication signature, and force it to be a download, use

std:file(file "authenticationSignature" "forceDownload")

Either a File or a FileIdentifier can be passed to the template functions. If the latter, the filename of the identifier will be displayed.

std:file(file [options])

Render a file with a thumbnail and filename, linking to the download.

std:file:thumbnail(file [options])

Render a file as a thumbnail only, linking to the download.

std:file:link(file [options])

Render a simple link to a file.

std:file:transform(file transform [options])

Like std:file(), but a file transform is specified for the link.

std:file:with-link-url(file url [“authenticationSignature”])

Renders the same as the std:file() template, but the download links to the supplied url, not the platform default. The only valid option to pass to this function is authenticationSignature, others will be silently ignored.

url should be generated using an HSVT url() function, to ensure proper formatting.

This template should only be used if your plugin is implementing its own file download handler.

std:file:thumbnail:with-link-url(file url [“authenticationSignature”])

Renders the same as the std:file:thumblnail() template, but the download links to the supplied url, not the platform default. The only valid option to pass to this function is authenticationSignature, others will be silently ignored.

url should be generated using an HSVT url() function, to ensure proper formatting.

This template should only be used if your plugin is implementing its own file download handler.