Link.file ViewHelper <f:link.file>
¶
A ViewHelper for creating links to a file (FAL).
Examples¶
Link to a file¶
<f:link.file file="{file}" target="_blank">See file</f:link.file>
Output of a public file:
<a href="https://example.com/fileadmin/path/to/file.jpg" target="_blank">See file</a>
Output of a non-public file:
<a href="https://example.com/index.php?eID=dumpFile&t=f&f=123&token=79bce812" target="_blank">See file</a>
Link to download a file¶
<f:link.file file="{file}" download="true" filename="alternative-name.jpg">Download file</f:link.file>
Output of a public file:
<a href="https://example.com/fileadmin/path/to/file.jpg" download="alternative-name.jpg">Download file</a>
Output of a non-public file:
<a href="https://example.com/index.php?eID=dumpFile&t=f&f=123&dl=1&fn=alternative-name.jpg&token=79bce812">Download file</a>
Source code¶
Go to the source code of this ViewHelper: FileViewHelper.php (GitHub).
Arguments¶
The following arguments are available for <f:link.file>
:
Name | Type | Default |
---|---|---|
mixed | ||
mixed | ||
mixed | ||
mixed | ||
boolean | ||
string | ||
string | ||
string | ||
string | ||
string | ||
string | ||
string | ||
string | ||
integer | ||
string | ||
string | ||
string | ||
string | ||
string |
-
additionalAttributes
¶ -
- Type
- mixed
- Required
true
Additional tag attributes. They will be added directly to the resulting HTML tag.
-
data
¶ -
- Type
- mixed
- Required
true
Additional data-* attributes. They will each be added with a "data-" prefix.
-
aria
¶ -
- Type
- mixed
- Required
true
Additional aria-* attributes. They will each be added with a "aria-" prefix.
-
file
¶ -
- Type
- mixed
- Required
true
Specifies the file to create a link to
-
download
¶ -
- Type
- boolean
- Required
true
Specifies if file should be downloaded instead of displayed
-
filename
¶ -
- Type
- string
- Required
true
Specifies an alternative filename. If filename contains a file extension, this must be the same as from 'file'.
-
class
¶ -
- Type
- string
- Required
true
CSS class(es) for this element
-
dir
¶ -
- Type
- string
- Required
true
Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left)
-
id
¶ -
- Type
- string
- Required
true
Unique (in this file) identifier for this HTML element.
-
lang
¶ -
- Type
- string
- Required
true
Language for this element. Use short names specified in RFC 1766
-
style
¶ -
- Type
- string
- Required
true
Individual CSS styles for this element
-
title
¶ -
- Type
- string
- Required
true
Tooltip text of element
-
accesskey
¶ -
- Type
- string
- Required
true
Keyboard shortcut to access this element
-
tabindex
¶ -
- Type
- integer
- Required
true
Specifies the tab order of this element
-
onclick
¶ -
- Type
- string
- Required
true
JavaScript evaluated for the onclick event
-
name
¶ -
- Type
- string
- Required
true
Specifies the name of an anchor
-
rel
¶ -
- Type
- string
- Required
true
Specifies the relationship between the current document and the linked document
-
rev
¶ -
- Type
- string
- Required
true
Specifies the relationship between the linked document and the current document
-
target
¶ -
- Type
- string
- Required
true
Specifies where to open the linked document