FileList

Class for rendering of File>Filelist (basically used in FileListController)

Internal

this is a concrete TYPO3 controller implementation and solely used for EXT:filelist and not part of TYPO3's Core API.

Tags
see
FileListController

Table of Contents

Properties

$addElement_tdCssClass  : array
Keys are fieldnames and values are td-css-classes to add in addElement();
$CBnames  : array
$clipObj  : Clipboard
$counter  : int
Counter increased for each element. Used to index elements for the JavaScript-code that transfers to the clipboard
$fieldArray  : array
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
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
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()  : File[]
sortFolders()  : Folder[]

Properties

$addElement_tdCssClass

Keys are fieldnames and values are td-css-classes to add in addElement();

public array $addElement_tdCssClass = ['_CONTROL_' => 'col-control', '_SELECTOR_' => 'col-selector', 'icon' => 'col-icon', 'name' => 'col-title col-responsive']

$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 $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

$totalItems

This could be set to the total number of items. Used by the fwd_rew_navigation.

public int $totalItems = 0

..

$backendUserCache

A runtime first-level cache to avoid unneeded calls to BackendUtility::getRecord()

protected array $backendUserCache = []

$eventDispatcher

protected EventDispatcherInterface $eventDispatcher

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 $data[, array $attributes = [] ][, bool $isTableHeader = false ]) : string

OBS: $this->fieldArray MUST be set! (represents the list of fields to display)

Parameters
$data : array

Is the data array, record with the fields. Notice: These fields are (currently) NOT htmlspecialchar'ed before being wrapped in -tags

$attributes : array = []

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(Folder[] $folders) : string
Parameters
$folders : 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(File[] $files) : string
Parameters
$files : 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
string

getTable()

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 $params = [] ]) : string
Parameters
$params : array = []
Return values
string —

URL

makeClip()

Creates the clipboard actions

public makeClip(File|Folder $fileOrFolderObject) : array
Parameters
$fileOrFolderObject : File|Folder

Array with information about the file/directory for which to make the clipboard actions for the listing.

Return values
array —

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
string

setColumnsToRender()

public setColumnsToRender([array $additionalFields = [] ]) : void
Parameters
$additionalFields : array = []

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
bool

getBackendUserInformation()

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
string

getConcreteTableName()

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
string

getFileOrFolderIcon()

Get the icon for a file or folder object

protected getFileOrFolderIcon(string $title, File|Folder $fileOrFolderObject) : string
Parameters
$title : string

The icon title

$fileOrFolderObject : File|Folder
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
int

getTranslationsForMetaData()

Fetch the translations for a sys_file_metadata record

protected getTranslationsForMetaData(array $metaDataRecord) : array<int, array<string, mixed>>
Parameters
$metaDataRecord : array
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
bool

makeCheckbox()

Adds the checkbox to select a file/folder in the listing

protected makeCheckbox(File|Folder $fileOrFolderObject) : string
Parameters
$fileOrFolderObject : File|Folder
Return values
string

makeTranslations()

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
string

renderCheckboxActions()

Render convenience actions, such as "check all"

protected renderCheckboxActions() : string
Return values
string —

HTML markup for the checkbox actions

On this page

Search results