FileList

class \TYPO3\CMS\Filelist\FileList

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

Tags

see
FileListController

Table of Contents

Properties

$addElement_tdCssClass  : array<string, string>
Keys are fieldnames and values are td-css-classes to add in addElement();
$clipObj  : Clipboard
$currentPage  : int
Current Page
$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.
$itemsPerPage  : int
Default Max items shown
$maxTitleLength  : int
Max length of strings
$mode  : Mode
$sortDirection  : SortDirection
$sortField  : string
The field to sort by
$thumbs  : bool
Thumbnails on records containing files (pictures)
$totalbytes  : int
Total file size of the current selection
$totalItems  : int
Total count of folders and files
$viewMode  : ViewMode
$componentFactory  : ComponentFactory
$eventDispatcher  : EventDispatcherInterface
$folderObject  : Folder
$iconFactory  : IconFactory
$onlineMediaHelperRegistry  : OnlineMediaHelperRegistry
$request  : ServerRequestInterface
$resourceDisplayMatcher  : Matcher|null
$resourceDownloadMatcher  : Matcher|null
$resourceFactory  : ResourceFactory
$resourceSelectableMatcher  : Matcher|null
$resourceSelectedMatcher  : Matcher|null
$searchDemand  : FileSearchDemand|null
$tcaSchemaFactory  : TcaSchemaFactory
$translateTools  : TranslationConfigurationProvider
$uriBuilder  : UriBuilder

Methods

__construct()  : mixed
addElement()  : string
Returns a table-row with the content from the fields in the input data array.
createModuleUri()  : string|null
Returns the list URL of the current view: the current folder, the current page and an active search term.
createPaginationUri()  : string|null
Returns the list URL used by the pagination, which appends the page to navigate to.
createSearchFormUri()  : string|null
Returns the list URL used as action of the search form. The search term is sent with the form itself, keeping it in the action would restore a cleared term from the URL of the next request.
getFieldLabel()  : string
getFolderInfo()  : string
Gets the number of files and total size of a folder
getSortableFields()  : string[]
render()  : string
setColumnsToRender()  : void
setMode()  : mixed
setResourceDisplayMatcher()  : self
setResourceDownloadMatcher()  : self
setResourceSelectableMatcher()  : self
setResourceSelectedMatcher()  : self
start()  : void
Initialization of class
createBaseParams()  : array
createControlCopy()  : ButtonInterface|null
createControlCut()  : ButtonInterface|null
createControlDelete()  : ButtonInterface|null
createControlDownload()  : ButtonInterface|null
createControlEditContent()  : ButtonInterface|null
createControlEditMetaData()  : ButtonInterface|null
createControlInfo()  : ButtonInterface|null
createControlPaste()  : ButtonInterface|null
createControlRename()  : ButtonInterface|null
createControlReplace()  : ButtonInterface|null
createControlSelect()  : ButtonInterface|null
createControlTranslation()  : ButtonInterface|null
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.
createControlUpdateOnlineMedia()  : ButtonInterface|null
createControlView()  : ButtonInterface|null
createEditContentUriForResource()  : string|null
createEditDataUriForResource()  : string|null
createListUri()  : string|null
Returns list URL, base params and priority params may be added
createModuleUriForElement()  : string|null
createModuleUriForResource()  : string|null
getBackendUser()  : BackendUserAuthentication
getConcreteTableName()  : string
Determine the concrete table name by checking if the field exists, while sys_file takes precedence.
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
getSortingValue()  : string
getSortingValueForFile()  : string
getSortingValueForFolder()  : string
getTranslationsForMetaData()  : array<int, array<string, mixed>>
Fetch the translations for a sys_file_metadata record
getUserPermissions()  : UserPermissions
isEditMetadataAllowed()  : bool
isFieldSortable()  : bool
renderCheckboxActions()  : string
Render convenience actions, such as "check all"
renderControl()  : string
Renders the control section
renderControlBrowse()  : string
Creates the control section for the element browser
renderControlManage()  : string
Creates the control section for the file list module
renderCreationTime()  : string
Render creation time
renderField()  : string
Render any resource field
renderIcon()  : string
Render icon
renderList()  : string
renderListTableBody()  : string
renderListTableFieldHeader()  : string
renderListTableHeader()  : string
renderModificationTime()  : string
Render modification time
renderName()  : string
Render name
renderPath()  : string
Render resource path
renderPermission()  : string
Render resource permission
renderReferenceCount()  : string
Render reference count. Wraps the count into a button to open the element information in case references exists.
renderSelector()  : string
Renders the checkbox to select a resource in the listing
renderSize()  : string
Render size
renderThumbnail()  : string
Render thumbnail
renderTiles()  : string
renderType()  : string
Render type
sortResources()  : ResourceInterface[]

Properties

$addElement_tdCssClass

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

public array<string, string> $addElement_tdCssClass = ['_CONTROL_' => 'col-control', '_SELECTOR_' => 'col-checkbox…
Show the full value['_CONTROL_' => 'col-control', '_SELECTOR_' => 'col-checkbox', 'icon' => 'col-icon', 'name' => 'col-title col-responsive']

$currentPage

Current Page

public int $currentPage = 1

$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 = []

$itemsPerPage

Default Max items shown

public int $itemsPerPage = 40

$maxTitleLength

Max length of strings

public int $maxTitleLength = 30

$mode

public Mode $mode = \TYPO3\CMS\Filelist\Type\Mode::MANAGE

$sortField

The field to sort by

public string $sortField = ''

$thumbs

Thumbnails on records containing files (pictures)

public bool $thumbs = false

$totalbytes

Total file size of the current selection

public int $totalbytes = 0

$totalItems

Total count of folders and files

public int $totalItems = 0

$eventDispatcher

protected EventDispatcherInterface $eventDispatcher

$request

protected ServerRequestInterface $request

$resourceDownloadMatcher

protected Matcher|null $resourceDownloadMatcher = null

$resourceSelectableMatcher

protected Matcher|null $resourceSelectableMatcher = null

$resourceSelectedMatcher

protected Matcher|null $resourceSelectedMatcher = null

Methods

__construct()

public __construct(ServerRequestInterface $request) : mixed

Parameters

$request : ServerRequestInterface

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

createModuleUri()

Returns the list URL of the current view: the current folder, the current page and an active search term.

public createModuleUri([array $params = [] ]) : string|null

Parameters

$params : array = []

Return values

string|null

createPaginationUri()

Returns the list URL used by the pagination, which appends the page to navigate to.

public createPaginationUri([array $params = [] ]) : string|null

Parameters

$params : array = []

Return values

string|null

createSearchFormUri()

Returns the list URL used as action of the search form. The search term is sent with the form itself, keeping it in the action would restore a cleared term from the URL of the next request.

public createSearchFormUri([array $params = [] ]) : string|null

Parameters

$params : array = []

Return values

string|null

getFieldLabel()

public getFieldLabel(string $field) : string

Parameters

$field : string

Return values

string

getFolderInfo()

Gets the number of files and total size of a folder

public getFolderInfo() : string

Return values

string

getSortableFields()

public getSortableFields() : string[]

Return values

string[]

setColumnsToRender()

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

Parameters

$additionalFields : array = []

setResourceDisplayMatcher()

public setResourceDisplayMatcher(Matcher|null $matcher) : self

Parameters

$matcher : Matcher|null

Return values

self

setResourceDownloadMatcher()

public setResourceDownloadMatcher(Matcher|null $matcher) : self

Parameters

$matcher : Matcher|null

Return values

self

setResourceSelectableMatcher()

public setResourceSelectableMatcher(Matcher|null $matcher) : self

Parameters

$matcher : Matcher|null

Return values

self

setResourceSelectedMatcher()

public setResourceSelectedMatcher(Matcher|null $matcher) : self

Parameters

$matcher : Matcher|null

Return values

self

start()

Initialization of class

public start(Folder $folderObject, int $currentPage, string $sortField, SortDirection $sortDirection[, Mode $mode = Mode::MANAGE ]) : void

Parameters

$folderObject : Folder

The folder to work on

$currentPage : int

The current page to render

$sortField : string

Sorting column

$sortDirection : SortDirection
$mode : Mode = Mode::MANAGE

Mode of the file list

createBaseParams()

protected createBaseParams([string[] $excludeList = [] ]) : array

Parameters

$excludeList : string[] = []

Parameters to leave out, e.g. "searchTerm" or "currentPage"

Return values

array

createControlTranslation()

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 createControlTranslation(ResourceView $resourceView) : ButtonInterface|null

Parameters

$resourceView : ResourceView

Return values

ButtonInterface|null

createListUri()

Returns list URL, base params and priority params may be added

protected createListUri([array $priorityParams = [] ][, mixed $baseParams = [] ]) : string|null

Parameters

$priorityParams : array = []
$baseParams : mixed = []

Return values

string|null

createModuleUriForElement()

protected createModuleUriForElement(int $fileUid) : string|null

Parameters

$fileUid : int

Return values

string|null

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

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

getSortingValueForFile()

protected getSortingValueForFile(File $resource, string $sortField) : string

Parameters

$resource : File
$sortField : string

Return values

string

getSortingValueForFolder()

protected getSortingValueForFolder(Folder $resource, string $sortField) : string

Parameters

$resource : Folder
$sortField : string

Return values

string

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 site language ids, values are the $rows

isEditMetadataAllowed()

protected isEditMetadataAllowed(File $file) : bool

Parameters

$file : File

Return values

bool

isFieldSortable()

protected isFieldSortable(string $field) : bool

Parameters

$field : string

Return values

bool

renderCheckboxActions()

Render convenience actions, such as "check all"

protected renderCheckboxActions() : string

Return values

string —

HTML markup for the checkbox actions

renderControl()

Renders the control section

protected renderControl(ResourceView $resourceView) : string

Parameters

$resourceView : ResourceView

Return values

string

renderControlBrowse()

Creates the control section for the element browser

protected renderControlBrowse(ResourceView $resourceView) : string

Parameters

$resourceView : ResourceView

Return values

string

renderCreationTime()

Render creation time

protected renderCreationTime(ResourceView $resourceView) : string

Parameters

$resourceView : ResourceView

Return values

string

renderField()

Render any resource field

protected renderField(ResourceView $resourceView, string $field) : string

Parameters

$resourceView : ResourceView
$field : string

Return values

string

renderListTableFieldHeader()

protected renderListTableFieldHeader(string $field) : string

Parameters

$field : string

Return values

string

renderListTableHeader()

protected renderListTableHeader() : string

Return values

string

renderModificationTime()

Render modification time

protected renderModificationTime(ResourceView $resourceView) : string

Parameters

$resourceView : ResourceView

Return values

string

renderPermission()

Render resource permission

protected renderPermission(ResourceView $resourceView) : string

Parameters

$resourceView : ResourceView

Return values

string

renderReferenceCount()

Render reference count. Wraps the count into a button to open the element information in case references exists.

protected renderReferenceCount(ResourceView $resourceView) : string

Parameters

$resourceView : ResourceView

Return values

string

renderSelector()

Renders the checkbox to select a resource in the listing

protected renderSelector(ResourceView $resourceView) : string

Parameters

$resourceView : ResourceView

Return values

string
On this page