IconFactory

Read onlyYes

The main factory class, which acts as the entrypoint for generating an Icon object which is responsible for rendering an icon. Checks for the correct icon provider through the IconRegistry.

Table of Contents

Methods

__construct()  : mixed
clearIconCache()  : void
getIcon()  : Icon
getIconForFileExtension()  : Icon
Get Icon for a file by its extension
getIconForRecord()  : Icon
This method is used throughout the TYPO3 Backend to show icons for a DB record
getIconForResource()  : Icon
This method is used throughout the TYPO3 Backend to show icons for files and folders
mapRecordTypeToIconIdentifier()  : string
This helper functions looks up the column that is used for the type of the chosen TCA table and then fetches the corresponding iconName based on the chosen icon class in this TCA.
createIcon()  : Icon
Creates an icon object
getRecordTypeForPageType()  : string
Returns recordType for icon based on a typeName and a suffix.
mapRecordTypeToOverlayIdentifier()  : string
This helper function checks if the DB record ($row) has any special status based on the TCA settings like hidden, starttime etc, and then returns a specific icon overlay identifier for the overlay of this DB record This method solely takes care of the overlay of this record, not any type

Methods

clearIconCache()

public clearIconCache() : void
Internal

Remove in v14. May have been used during testing in TYPO3 <v14.

getIcon()

public getIcon(string $identifier[, IconSize $size = IconSize::MEDIUM ][, string|null $overlayIdentifier = null ][, IconState|null $state = null ]) : Icon
Parameters
$identifier : string
$size : IconSize = IconSize::MEDIUM
$overlayIdentifier : string|null = null
$state : IconState|null = null
Return values
Icon

getIconForFileExtension()

Get Icon for a file by its extension

public getIconForFileExtension(string $fileExtension[, IconSize $size = IconSize::MEDIUM ][, string|null $overlayIdentifier = null ]) : Icon
Parameters
$fileExtension : string
$size : IconSize = IconSize::MEDIUM
$overlayIdentifier : string|null = null
Return values
Icon

getIconForRecord()

This method is used throughout the TYPO3 Backend to show icons for a DB record

public getIconForRecord(string $table, array<string|int, mixed> $row[, IconSize $size = IconSize::MEDIUM ]) : Icon
Parameters
$table : string
$row : array<string|int, mixed>
$size : IconSize = IconSize::MEDIUM
Return values
Icon

getIconForResource()

This method is used throughout the TYPO3 Backend to show icons for files and folders

public getIconForResource(ResourceInterface $resource[, IconSize $size = IconSize::MEDIUM ][, string|null $overlayIdentifier = null ][, array<string|int, mixed> $options = [] ]) : Icon

The method takes care of the translation of file extension to proper icon and for folders it will return the icon depending on the role of the folder.

If the given resource is a folder there are some additional options that can be used:

  • mount-root => TRUE (to indicate this is the root of a mount)
  • folder-open => TRUE (to indicate that the folder is opened in the file tree)

There is a hook in place to manipulate the icon name and overlays.

Parameters
$resource : ResourceInterface
$size : IconSize = IconSize::MEDIUM
$overlayIdentifier : string|null = null
$options : array<string|int, mixed> = []

An associative array with additional options.

Return values
Icon

mapRecordTypeToIconIdentifier()

This helper functions looks up the column that is used for the type of the chosen TCA table and then fetches the corresponding iconName based on the chosen icon class in this TCA.

public mapRecordTypeToIconIdentifier(string $table, array<string|int, mixed> $row) : string

The TCA looks up

  • [ctrl][typeicon_column]

This method solely takes care of the type of this record, not any statuses used for overlays.

see EXT:core/Configuration/TCA/pages.php for an example with the TCA table "pages"

Parameters
$table : string

The TCA table

$row : array<string|int, mixed>

The selected record

Internal
Tags
TODO:

make this method protected, after FormEngine doesn't need it anymore.

Return values
string

The icon identifier string for the icon of that DB record

createIcon()

Creates an icon object

protected createIcon(string $identifier, IconSize $size[, string|null $overlayIdentifier = null ][, array<string|int, mixed> $iconConfiguration = [] ]) : Icon
Parameters
$identifier : string
$size : IconSize
$overlayIdentifier : string|null = null
$iconConfiguration : array<string|int, mixed> = []

the icon configuration array

Return values
Icon

getRecordTypeForPageType()

Returns recordType for icon based on a typeName and a suffix.

protected getRecordTypeForPageType(string $typeName, string $suffix, string $table[, string $fallbackTypeName = '1' ]) : string

Fallback to page as typeName if resulting type is not configured.

Parameters
$typeName : string
$suffix : string
$table : string
$fallbackTypeName : string = '1'
Return values
string

mapRecordTypeToOverlayIdentifier()

This helper function checks if the DB record ($row) has any special status based on the TCA settings like hidden, starttime etc, and then returns a specific icon overlay identifier for the overlay of this DB record This method solely takes care of the overlay of this record, not any type

protected mapRecordTypeToOverlayIdentifier(string $table, array<string|int, mixed> $row) : string
Parameters
$table : string

The TCA table

$row : array<string|int, mixed>

The selected record

Return values
string

The status with the highest priority


        
On this page

Search results