[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.file = EXT:myextension/Resources/Private/Templates/ContentObjects/Image.html
18 tt_content.image.20.dataProcessing.10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
19
20 # the field name where relations are set
21 # + stdWrap
22 tt_content.image.20.dataProcessing.10.references.fieldName = image
23
24 # the table name where relations are put, defaults to the currently selected record from $cObj->getTable()
25 # + stdWrap
26 tt_content.image.20.dataProcessing.10.references.table = tt_content
27
28 # A list of sys_file UID records
29 # + stdWrap
30 tt_content.image.20.dataProcessing.10.files = 21,42
31
32 # A list of File Collection UID records
33 # + stdWrap
34 tt_content.image.20.dataProcessing.10.collections = 13,14
35
36 # A list of FAL Folder identifiers
37 # + stdWrap
38 tt_content.image.20.dataProcessing.10.folders = 1:introduction/images/,1:introduction/posters/
39
40 # Property of which the files should be sorted after they have been accumulated + stdWrap
41 # can be any property of sys_file, sys_file_metadata
42 tt_content.image.20.dataProcessing.10.sorting = description
43
44 # Can be "ascending", "descending" or "random", defaults to "ascending" if none given + stdWrap
45 tt_content.image.20.dataProcessing.10.sorting.direction = descending
46
47 # The target variable to be handed to the ContentObject again, can be used
48 # in Fluid e.g. to iterate over the objects. defaults to "files" when non given
49 # + stdWrap
50 tt_content.image.20.dataProcessing.10.as = myfiles
51
52
53 In the Fluid template then iterate over the files:
54
55 .. code-block:: html
56 <ul>
57 <f:for each="{myfiles}" as="file">
58 <li><a href="{file.publicUrl}">{file.name}</a></li>
59 </f:for>
60 </ul>