FileCollector implements Countable, LoggerAwareInterface uses LoggerAwareTrait
Object to collect files from various sources during runtime Sources can be file references, file collections or folders
Use in FILES Content Object or for a Fluid Data Processor
Is not persisted, use only in FE.
this is an internal TYPO3 implementation and solely used for EXT:frontend and not part of TYPO3's Core API.
Table of Contents
Interfaces
- Countable
- LoggerAwareInterface
Properties
- $fileCollectionRepository : FileCollectionRepository
- The file collection repository
- $fileRepository : FileRepository
- The file repository
- $files : array<string|int, mixed>
- The files
- $resourceFactory : ResourceFactory
- The resource factory
Methods
- addFileObject() : mixed
- Add a file object to the collection
- addFileObjects() : mixed
- Add multiple file objects to the collection
- addFileReferences() : mixed
- Add files from UIDs of a reference
- addFiles() : mixed
- Add files
- addFilesFromFileCollection() : mixed
- Add files to the collection from one single file collection
- addFilesFromFileCollections() : mixed
- Add files to the collection from multiple file collections
- addFilesFromFolder() : mixed
- Add files to the collection from one single folder
- addFilesFromFolders() : mixed
- Add files to the collection from multiple folders
- addFilesFromRelation() : mixed
- Add files to the collection from a relation
- count() : int
- getFiles() : array<string|int, mixed>
- Final getter method to fetch the accumulated data
- sort() : mixed
- Sort the file objects based on a property
- getFileCollectionRepository() : FileCollectionRepository
- getFileReferences() : array<string|int, mixed>
- Gets file references for a given record field, also deal with translated elements, where file references could be attached.
- getFileRepository() : FileRepository
- getResourceFactory() : ResourceFactory
Properties
$fileCollectionRepository
The file collection repository
protected
FileCollectionRepository
$fileCollectionRepository
$fileRepository
The file repository
protected
FileRepository
$fileRepository
$files
The files
protected
array<string|int, mixed>
$files
= []
$resourceFactory
The resource factory
protected
ResourceFactory
$resourceFactory
Methods
addFileObject()
Add a file object to the collection
public
addFileObject(FileInterface $file) : mixed
Parameters
- $file : FileInterface
-
The file object
addFileObjects()
Add multiple file objects to the collection
public
addFileObjects(array<string|int, FileInterface> $files) : mixed
Parameters
- $files : array<string|int, FileInterface>
-
The file objects
addFileReferences()
Add files from UIDs of a reference
public
addFileReferences([array<string|int, mixed> $fileReferenceUids = [] ]) : mixed
Parameters
- $fileReferenceUids : array<string|int, mixed> = []
addFiles()
Add files
public
addFiles([array<string|int, mixed> $fileUids = [] ]) : mixed
Parameters
- $fileUids : array<string|int, mixed> = []
addFilesFromFileCollection()
Add files to the collection from one single file collection
public
addFilesFromFileCollection([int $fileCollectionUid = null ]) : mixed
Parameters
- $fileCollectionUid : int = null
-
The file collections uid
addFilesFromFileCollections()
Add files to the collection from multiple file collections
public
addFilesFromFileCollections([array<string|int, mixed> $fileCollectionUids = [] ]) : mixed
Parameters
- $fileCollectionUids : array<string|int, mixed> = []
-
The file collections uids
addFilesFromFolder()
Add files to the collection from one single folder
public
addFilesFromFolder(string $folderIdentifier[, bool $recursive = false ]) : mixed
Parameters
- $folderIdentifier : string
-
The folder identifier
- $recursive : bool = false
-
Add files recursive from given folders
addFilesFromFolders()
Add files to the collection from multiple folders
public
addFilesFromFolders([array<string|int, mixed> $folderIdentifiers = [] ][, bool $recursive = false ]) : mixed
Parameters
- $folderIdentifiers : array<string|int, mixed> = []
-
The folder identifiers
- $recursive : bool = false
-
Add files recursive from given folders
addFilesFromRelation()
Add files to the collection from a relation
public
addFilesFromRelation(string $relationTable, string $relationField, array<string|int, mixed> $referenceRecord) : mixed
Parameters
- $relationTable : string
-
The table of the relation (e.g. tt_content or pages)
- $relationField : string
-
The field which holds the files (e.g. media or images)
- $referenceRecord : array<string|int, mixed>
-
the record which is referencing the files
count()
public
count() : int
Return values
intgetFiles()
Final getter method to fetch the accumulated data
public
getFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>sort()
Sort the file objects based on a property
public
sort([string $sortingProperty = '' ][, string $sortingOrder = 'ascending' ]) : mixed
Parameters
- $sortingProperty : string = ''
-
The sorting property
- $sortingOrder : string = 'ascending'
-
can be ascending or descending or "random"
getFileCollectionRepository()
protected
getFileCollectionRepository() : FileCollectionRepository
Return values
FileCollectionRepositorygetFileReferences()
Gets file references for a given record field, also deal with translated elements, where file references could be attached.
protected
getFileReferences(string $tableName, string $fieldName, array<string|int, mixed> $element) : array<string|int, mixed>
Parameters
- $tableName : string
-
Name of the table
- $fieldName : string
-
Name of the field
- $element : array<string|int, mixed>
-
The parent element referencing to files
Return values
array<string|int, mixed>getFileRepository()
protected
getFileRepository() : FileRepository
Return values
FileRepositorygetResourceFactory()
protected
getResourceFactory() : ResourceFactory