Resolve FAL relations and return file records.
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
.
/
<v:resource.record.fal table="NULL" field="NULL" record="{foo: 'bar'}" uid="123" as="NULL"> <!-- tag content - may be ignored! --> </v:resource.record.fal>
{v:resource.record.fal(table: 'NULL', field: 'NULL', record: {foo: 'bar'}, uid: 123, as: 'NULL')}
commit c773c4577d737b6dd6a792b7a3b4290c193336f9 Author: Danilo Bürger <*****@hmspl.de> Date: Sat Nov 16 14:44:10 2013 +0100 [FEATURE] Added record view helper commit 3057461fb330405d2c79bd1106ebf7fb82e322dd Author: Cedric Ziel <*****@cedric-ziel.com> Date: Mon Dec 23 02:12:06 2013 +0100 [FEATURE] Sort resources by foreign ordering commit d2e531da034976e6db1478eef5a8478595fd16fe Author: Claus Due <*****@namelesscoder.net> Date: Sun Jan 5 00:45:10 2014 +0100 [TASK] Migrate to using namespace core class names commit 8f8d9a6ee4791bc76edcf8f57c03b743efa7191a Author: Danilo Bürger <*****@hmspl.de> Date: Wed Apr 2 15:58:47 2014 +0200 [BUGFIX] Pull in metadata with fal 6.2 Fixes #515 commit 1bef302ef456ff2b6e3eeaaeef219806b6ab3abe Author: Benjamin Rau <*****@codearts.at> Date: Fri Apr 11 22:20:28 2014 +0200 [BUGFIX] Complete array returned for fileReference When we replaced toArray with getProperties to get file reference the properties of the File itself were no longer available because toArray performed a array_merge internally. For that we created a own method getFileArray but didn't use this in content.resources.fal yet. This bugfix moves that method to a utility and replaces all usages of that method to use it on the utility. Fixes: #532 commit 9b63608501c44e4c71804b4ae1b93e7b93c35b93 Author: Danilo Bürger <*****@hmspl.de> Date: Tue Apr 29 01:21:02 2014 +0200 [BUGFIX] Merge with add file and file reference properties commit f578e2d171212d5ec2e33f557e3d78e817cce328 Author: mhirdes <*****@clickstorm.de> Date: Mon Jun 2 16:37:07 2014 +0200 [BUGFIX] Merge the fal properties correctly #595 commit 89baf38f6e2649377fdaafcdaffa630098f4f684 Author: Claus Due <*****@namelesscoder.net> Date: Mon Jun 2 16:43:43 2014 +0200 [BUGFIX] Incorrect return value from Resource / Record / Fal ViewHelper commit da7677bc74f14e9a9300e4ba4487e52c3cb97642 Author: Claus Due <*****@namelesscoder.net> Date: Sun Apr 20 01:13:33 2014 +0200 [TASK] Switch to namespaces commit 12ff0ddfb8d36c51f2d3befde7ae812177c80d5d Author: Xaver Maierhofer <*****@xwissen.info> Date: Wed Jun 11 00:01:47 2014 +0200 [TASK] CGL remove use leading backslash PHP Docs Note that for namespaced names (fully qualified namespace names containing namespace separator, such as Foo\Bar as opposed to global names that do not, such as FooBar), the leading backslash is unnecessary and not recommended, as import names must be fully qualified, and are not processed relative to the current namespace. commit 4981055359c895f3869e5bd878293b3c15ed26e5 Author: Xaver Maierhofer <*****@xwissen.info> Date: Sun Jan 18 14:01:04 2015 +0100 [TASK] CGL - Define classes, params, use imports commit 8bb2fc5ee124ba19b0a0ab8e061c9a153fc4651f Author: Xaver Maierhofer <*****@xwissen.info> Date: Sun Jan 18 17:56:13 2015 +0100 [TASK] Reference Copyright to license.md file