FileList
Class for rendering of File>Filelist (basically used in FileListController)
this is a concrete TYPO3 controller implementation and solely used for EXT:filelist and not part of TYPO3's Core API.
Tags
Table of Contents
Properties
- $addElement_tdCssClass : array<string|int, mixed>
- Keys are fieldnames and values are td-css-classes to add in addElement();
- $CBnames : array<string|int, mixed>
- $clipObj : Clipboard
- $counter : int
- Counter increased for each element. Used to index elements for the JavaScript-code that transfers to the clipboard
- $fieldArray : array<string|int, mixed>
- Decides the columns shown. Filled with values that refers to the keys of the data-array. $this->fieldArray[0] is the title column.
- $firstElementNumber : int
- $fixedL : int
- Max length of strings
- $iLimit : int
- Default Max items shown
- $sort : string
- The field to sort by
- $sortRev : bool
- Reverse sorting flag
- $spaceIcon : string
- Space icon used for alignment when no button is available
- $thumbs : bool
- Thumbnails on records containing files (pictures)
- $totalbytes : int
- $totalItems : int
- This could be set to the total number of items. Used by the fwd_rew_navigation.
- $translateTools : TranslationConfigurationProvider
- $backendUserCache : array<string|int, mixed>
- A runtime first-level cache to avoid unneeded calls to BackendUtility::getRecord()
- $eventDispatcher : EventDispatcherInterface
- $fileExtensionFilter : FileExtensionFilter|null
- $folderObject : Folder
- $iconFactory : IconFactory
- $id : int
- $resourceFactory : ResourceFactory
- $searchDemand : FileSearchDemand|null
- $uriBuilder : UriBuilder
Methods
- __construct() : mixed
- addElement() : string
- Returns a table-row with the content from the fields in the input data array.
- formatDirList() : string
- This returns tablerows for the directories in the array $items['sorting'].
- formatFileList() : string
- This returns tablerows for the files in the array $items['sorting'].
- fwd_rwd_nav() : string
- Creates a forward/reverse button based on the status of ->eCounter, ->firstElementNumber, ->iLimit
- getFolderInfo() : string
- Gets the number of files and total size of a folder
- getTable() : string
- Returns a table with directories and files listed.
- linkWrapDir() : string
- Wraps the directory-titles
- linkWrapFile() : string
- Wraps filenames in links which opens the metadata editor.
- linkWrapSort() : string
- Wraps a field label for the header row into a link to the filelist with sorting commands
- listURL() : string
- Returns list URL; This is the URL of the current script with id and imagemode parameters, that's all.
- makeClip() : array<string|int, mixed>
- Creates the clipboard actions
- makeEdit() : string
- Creates the edit control section
- makeRef() : string
- Make reference count. Wraps the count into a button to open the element information in case references exists.
- setColumnsToRender() : void
- start() : mixed
- Initialization of class
- fileDownloadEnabled() : bool
- Whether file download is enabled for the user
- getBackendUser() : BackendUserAuthentication
- Returns the current BE user.
- getBackendUserInformation() : string
- Helper method around fetching a "cruser_id" information for a record, with a cache, so the same information does not have to be processed for the same user over and over again.
- getConcreteTableName() : string
- Determine the concrete table name by checking if the field exists, while sys_file takes precedence.
- getFileOrFolderIcon() : string
- Get the icon for a file or folder object
- getFileReferenceCount() : int
- Counts how often the given file is referenced. This is done by looking up the file in the "sys_refindex" table, while excluding sys_file_metadata relations as these are no such references.
- getLanguageService() : LanguageService
- Returns an instance of LanguageService
- getTranslationsForMetaData() : array<int, array<string, mixed>>
- Fetch the translations for a sys_file_metadata record
- isEditMetadataAllowed() : bool
- makeCheckbox() : string
- Adds the checkbox to select a file/folder in the listing
- makePath() : string
- Generate readable path
- makeTranslations() : string
- Creates the file metadata translation dropdown. Each item links to the corresponding metadata translation, while depending on the current state, either a new translation can be created or an existing translation can be edited.
- renderCheckboxActions() : string
- Render convenience actions, such as "check all"
- sortFiles() : array<string|int, File>
- sortFolders() : array<string|int, Folder>
Properties
$addElement_tdCssClass
Keys are fieldnames and values are td-css-classes to add in addElement();
public
array<string|int, mixed>
$addElement_tdCssClass
= ['_CONTROL_' => 'col-control', '_SELECTOR_' => 'col-selector', 'icon' => 'col-icon', 'name' => 'col-title col-responsive']
$CBnames
public
array<string|int, mixed>
$CBnames
= []
$clipObj
public
Clipboard
$clipObj
$counter
Counter increased for each element. Used to index elements for the JavaScript-code that transfers to the clipboard
public
int
$counter
= 0
$fieldArray
Decides the columns shown. Filled with values that refers to the keys of the data-array. $this->fieldArray[0] is the title column.
public
array<string|int, mixed>
$fieldArray
= []
$firstElementNumber
public
int
$firstElementNumber
= 0
$fixedL
Max length of strings
public
int
$fixedL
= 30
$iLimit
Default Max items shown
public
int
$iLimit
= 40
$sort
The field to sort by
public
string
$sort
= ''
$sortRev
Reverse sorting flag
public
bool
$sortRev
= true
$spaceIcon
Space icon used for alignment when no button is available
public
string
$spaceIcon
$thumbs
Thumbnails on records containing files (pictures)
public
bool
$thumbs
= false
$totalbytes
public
int
$totalbytes
= 0
$totalItems
This could be set to the total number of items. Used by the fwd_rew_navigation.
public
int
$totalItems
= 0
..
$translateTools
public
TranslationConfigurationProvider
$translateTools
$backendUserCache
A runtime first-level cache to avoid unneeded calls to BackendUtility::getRecord()
protected
array<string|int, mixed>
$backendUserCache
= []
$eventDispatcher
protected
EventDispatcherInterface
$eventDispatcher
$fileExtensionFilter
protected
FileExtensionFilter|null
$fileExtensionFilter
= null
$folderObject
protected
Folder
$folderObject
$iconFactory
protected
IconFactory
$iconFactory
$id
protected
int
$id
= 0
$resourceFactory
protected
ResourceFactory
$resourceFactory
$searchDemand
protected
FileSearchDemand|null
$searchDemand
= null
$uriBuilder
protected
UriBuilder
$uriBuilder
Methods
__construct()
public
__construct([ServerRequestInterface|null $request = null ]) : mixed
Parameters
- $request : ServerRequestInterface|null = null
addElement()
Returns a table-row with the content from the fields in the input data array.
public
addElement(array<string|int, mixed> $data[, array<string|int, mixed> $attributes = [] ][, bool $isTableHeader = false ]) : string
OBS: $this->fieldArray MUST be set! (represents the list of fields to display)
Parameters
- $data : array<string|int, mixed>
-
Is the data array, record with the fields. Notice: These fields are (currently) NOT htmlspecialchar'ed before being wrapped in
-tags - $attributes : array<string|int, mixed> = []
Attributes for the table row. Values will be htmlspecialchar'ed!
- $isTableHeader : bool = false
Whether the element to be added is a table header
Return values
string —HTML content for the table row
formatDirList()
This returns tablerows for the directories in the array $items['sorting'].
public formatDirList(array<string|int, Folder> $folders) : string
Parameters
- $folders : array<string|int, Folder>
-
Folders of \TYPO3\CMS\Core\Resource\Folder
Return values
string —HTML table rows.
formatFileList()
This returns tablerows for the files in the array $items['sorting'].
public formatFileList(array<string|int, File> $files) : string
Parameters
- $files : array<string|int, File>
-
File items
Return values
string —HTML table rows.
fwd_rwd_nav()
Creates a forward/reverse button based on the status of ->eCounter, ->firstElementNumber, ->iLimit
public fwd_rwd_nav(int $currentItemCount) : string
Parameters
- $currentItemCount : int
Return values
string —the table-row code for the element
getFolderInfo()
Gets the number of files and total size of a folder
public getFolderInfo() : string
Return values
stringgetTable()
Returns a table with directories and files listed.
public getTable([FileSearchDemand|null $searchDemand = null ]) : string
Parameters
- $searchDemand : FileSearchDemand|null = null
Return values
string —HTML-table
linkWrapDir()
Wraps the directory-titles
public linkWrapDir(string $title, Folder $folderObject) : string
Parameters
- $title : string
-
String to be wrapped in links
- $folderObject : Folder
-
Folder to work on
Return values
string —HTML
linkWrapFile()
Wraps filenames in links which opens the metadata editor.
public linkWrapFile(string $code, File $fileObject) : string
Parameters
- $code : string
-
String to be wrapped in links
- $fileObject : File
-
File to be linked
Return values
string —HTML
linkWrapSort()
Wraps a field label for the header row into a link to the filelist with sorting commands
public linkWrapSort(string $fieldName[, string $label = '' ]) : string
Parameters
- $fieldName : string
-
The field to sort
- $label : string = ''
-
The label to be wrapped - will be determined if not given
Return values
string —The constructed link - HTML
listURL()
Returns list URL; This is the URL of the current script with id and imagemode parameters, that's all.
public listURL([array<string|int, mixed> $params = [] ]) : string
Parameters
- $params : array<string|int, mixed> = []
Return values
string —URL
makeClip()
Creates the clipboard actions
public makeClip(File|Folder $fileOrFolderObject) : array<string|int, mixed>
Parameters
- $fileOrFolderObject : File|Folder
-
Array with information about the file/directory for which to make the clipboard actions for the listing.
Return values
array<string|int, mixed> —clipboard actions
makeEdit()
Creates the edit control section
public makeEdit(File|Folder $fileOrFolderObject) : string
Parameters
- $fileOrFolderObject : File|Folder
-
Array with information about the file/directory for which to make the edit control section for the listing.
Return values
string —HTML-table
makeRef()
Make reference count. Wraps the count into a button to open the element information in case references exists.
public makeRef(File $file) : string
Parameters
- $file : File
Return values
stringsetColumnsToRender()
public setColumnsToRender([array<string|int, mixed> $additionalFields = [] ]) : void
Parameters
- $additionalFields : array<string|int, mixed> = []
start()
Initialization of class
public start(Folder $folderObject, int $pointer, string $sort, bool $sortRev) : mixed
Parameters
- $folderObject : Folder
-
The folder to work on
- $pointer : int
-
Pointer
- $sort : string
-
Sorting column
- $sortRev : bool
-
Sorting direction
fileDownloadEnabled()
Whether file download is enabled for the user
protected fileDownloadEnabled() : bool
Return values
boolgetBackendUser()
Returns the current BE user.
protected getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetBackendUserInformation()
Helper method around fetching a "cruser_id" information for a record, with a cache, so the same information does not have to be processed for the same user over and over again.
protected getBackendUserInformation(int $backendUserId) : string
Parameters
- $backendUserId : int
Return values
stringgetConcreteTableName()
Determine the concrete table name by checking if the field exists, while sys_file takes precedence.
protected getConcreteTableName(string $fieldName) : string
Parameters
- $fieldName : string
Return values
stringgetFileOrFolderIcon()
Get the icon for a file or folder object
protected getFileOrFolderIcon(string $title, File|Folder $fileOrFolderObject) : string
Parameters
Return values
string —The wrapped icon for the file or folder
getFileReferenceCount()
Counts how often the given file is referenced. This is done by looking up the file in the "sys_refindex" table, while excluding sys_file_metadata relations as these are no such references.
protected getFileReferenceCount(File $file) : int
Parameters
- $file : File
Return values
intgetLanguageService()
Returns an instance of LanguageService
protected getLanguageService() : LanguageService
Return values
LanguageServicegetTranslationsForMetaData()
Fetch the translations for a sys_file_metadata record
protected getTranslationsForMetaData(array<string|int, mixed> $metaDataRecord) : array<int, array<string, mixed>>
Parameters
- $metaDataRecord : array<string|int, mixed>
Return values
array<int, array<string, mixed>> —keys are the sys_language uids, values are the $rows
isEditMetadataAllowed()
protected isEditMetadataAllowed(File $file) : bool
Parameters
- $file : File
Return values
boolmakeCheckbox()
Adds the checkbox to select a file/folder in the listing
protected makeCheckbox(File|Folder $fileOrFolderObject) : string
Parameters
Return values
stringmakePath()
Generate readable path
protected makePath(ResourceInterface $resource) : string
Parameters
- $resource : ResourceInterface
Return values
stringmakeTranslations()
Creates the file metadata translation dropdown. Each item links to the corresponding metadata translation, while depending on the current state, either a new translation can be created or an existing translation can be edited.
protected makeTranslations(File $file) : string
Parameters
- $file : File
Return values
stringrenderCheckboxActions()
Render convenience actions, such as "check all"
protected renderCheckboxActions() : string
Return values
string —HTML markup for the checkbox actions
sortFiles()
protected sortFiles(array<string|int, File> $files) : array<string|int, File>
Parameters
- $files : array<string|int, File>
Return values
array<string|int, File>sortFolders()
protected sortFolders(array<string|int, Folder> $folders) : array<string|int, Folder>
Parameters
- $folders : array<string|int, Folder>
Return values
array<string|int, Folder>Search results