resource.record.fal ViewHelper <vhs:resource.record.fal>
¶
Resolve FAL relations and return file records.
Render a single image linked from a TCA record¶
We assume that the table tx_users
has a column photo
, which is a FAL
relation field configured with
[ExtensionManagementUtility::getFileFieldTCAConfig()
]
(https://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Inline/Index.html#file-abstraction-layer).
The template also has a user
variable containing one of the table's
records.
At first, fetch the record and store it in a variable.
Then use <f:image>
to render it:
{v:resource.record.fal(table: 'tx_users', field: 'photo', record: user)
-> v:iterator.first()
-> v:variable.set(name: 'image')}
<f:if condition="{image}">
<f:image treatIdAsReference="1" src="{image.id}" title="{image.title}" alt="{image.alternative}"/>
</f:if>
Use the uid
attribute if you don't have a record
.
Arguments¶
table¶
- DataType
string
- Required
true
- Description
The table to lookup records.
field¶
- DataType
string
- Required
true
- Description
The field of the table associated to resources.
record¶
- DataType
mixed
- Required
false
- Description
The actual record. Alternatively you can use the "uid" argument.
uid¶
- DataType
integer
- Required
false
- Description
The uid of the record. Alternatively you can use the "record" argument.
as¶
- DataType
string
- Required
false
- Description
If specified, a template variable with this name containing the requested data will be inserted instead of returning it.
asObjects¶
- DataType
boolean
- Required
false
- Description
Can be set to TRUE to return objects instead of file information arrays.