[FOLLOWUP][FEATURE] Introduce Data Processor for Files
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Documentation / Changelog / master / Feature-67662-DataProcessorForFiles.rst
1 =========================================
2 Feature: #67662 - DataProcessor for files
3 =========================================
4
5 Description
6 ===========
7
8 A new Files DataProcessor has been introduced, which can be used to prepare data to be handled by a ContentObject
9 implementing the processors, e.g. the FLUIDTEMPLATE ContentObject. The FilesProcessor resolves File References, Files,
10 or Files inside a folder or collection to be used for output in the Frontend. A FLUIDTEMPLATE can then simply iterate
11 over processed data automatically.
12
13
14 .. code-block:: typoscript
15
16 tt_content.image.20 = FLUIDTEMPLATE
17 tt_content.image.20 {
18 file = EXT:myextension/Resources/Private/Templates/ContentObjects/Image.html
19
20 dataProcessing.10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
21 dataProcessing.10 {
22 # the field name where relations are set
23 # + stdWrap
24 references.fieldName = image
25
26 # the table name where relations are put, defaults to the currently selected record from $cObj->getTable()
27 # + stdWrap
28 references.table = tt_content
29
30 # A list of sys_file UID records
31 # + stdWrap
32 files = 21,42
33
34 # A list of File Collection UID records
35 # + stdWrap
36 collections = 13,14
37
38 # A list of FAL Folder identifiers
39 # + stdWrap
40 folders = 1:introduction/images/,1:introduction/posters/
41
42 # Property of which the files should be sorted after they have been accumulated
43 # can be any property of sys_file, sys_file_metadata
44 # + stdWrap
45 sorting = description
46
47 # Can be "ascending", "descending" or "random", defaults to "ascending" if none given
48 # + stdWrap
49 sorting.direction = descending
50
51 # The target variable to be handed to the ContentObject again, can be used
52 # in Fluid e.g. to iterate over the objects. defaults to "files" when not defined
53 # + stdWrap
54 as = myfiles
55 }
56 }
57
58 In the Fluid template then iterate over the files:
59
60 .. code-block:: html
61 <ul>
62 <f:for each="{myfiles}" as="file">
63 <li><a href="{file.publicUrl}">{file.name}</a></li>
64 </f:for>
65 </ul>