IconRegistry

class \TYPO3\CMS\Core\Imaging\IconRegistry

Implements
SingletonInterface

Class which makes it possible to register custom icons from within an extension.

Table of Contents

Interfaces

SingletonInterface
"empty" interface for singletons (marker interface pattern)

Properties

$backendIconDeclaration  : string
$backendIconsInitialized  : bool
$cache  : FrontendInterface
$defaultIconIdentifier  : string
$deprecatedIcons  : array
Array of deprecated icons, add deprecated icons to this array and remove it from registry - Index of this array contains the deprecated icon - Value of each entry may contain a possible new identifier
$fileExtensionMapping  : string[]
Mapping of file extensions to mimetypes
$flagsInitialized  : bool
$fullInitialized  : bool
$iconAliases  : array<string, string>
$icons  : array
Registered icons
$mimeTypeMapping  : string[]
Mapping of mime types to icons
$staticIcons  : array
manually registered icons hopefully obsolete one day
$tcaInitialized  : bool

Methods

__construct()  : mixed
detectIconProvider()  : string
Detect the IconProvider of an icon
getAllRegisteredIconIdentifiers()  : array
getBackendIconsCacheIdentifier()  : string
getDefaultIconIdentifier()  : string
getDeprecatedIcons()  : array
getIconConfigurationByIdentifier()  : mixed
Fetches the configuration provided by registerIcon()
getIconIdentifierForFileExtension()  : string
getIconIdentifierForMimeType()  : string|null
Get iconIdentifier for given mimeType
isDeprecated()  : bool
isRegistered()  : bool
registerAlias()  : mixed
Registers an icon to be available inside the Icon Factory
registerFileExtension()  : mixed
Register an icon for a file extension
registerIcon()  : mixed
Registers an icon to be available inside the Icon Factory
registerMimeTypeIcon()  : mixed
Register an icon for a mime-type
warmupCaches()  : void
getCachedBackendIcons()  : mixed
Retrieve the icons from cache render them when not cached yet
getCachedFlagIcons()  : void
initialize()  : mixed
Initialize the registry This method can be called multiple times, depending on initialization status.
registerBackendIcons()  : void
Automatically find and register the core backend icons
registerFlags()  : array
Register flags
registerTCAIcons()  : mixed
Load icons from TCA for each table and add them as "tcarecords-XX" to $this->icons

Properties

$backendIconDeclaration

protected string $backendIconDeclaration = 'EXT:core/Resources/Public/Icons/T3Icons/icons.json'

$backendIconsInitialized

protected bool $backendIconsInitialized = false

$defaultIconIdentifier

protected string $defaultIconIdentifier = 'default-not-found'

$deprecatedIcons

Array of deprecated icons, add deprecated icons to this array and remove it from registry - Index of this array contains the deprecated icon - Value of each entry may contain a possible new identifier

protected array $deprecatedIcons = []

Example: [ 'deprecated-icon-identifier' => ['since' => 'TYPO3 v12', 'until' => 'TYPO3 v13', 'replacement' => 'new-icon-identifier'], 'another-deprecated-identifier' => ['since' => 'TYPO3 v12', 'until' => 'TYPO3 v13', 'replacement' => null], ]

$fileExtensionMapping

Mapping of file extensions to mimetypes

protected string[] $fileExtensionMapping = ['htm' => 'mimetypes-text-html', 'html' => 'mimetypes-text-h…
Show the full value['htm' => 'mimetypes-text-html', 'html' => 'mimetypes-text-html', 'css' => 'mimetypes-text-css', 'js' => 'mimetypes-text-js', 'csv' => 'mimetypes-text-csv', 'php' => 'mimetypes-text-php', 'php6' => 'mimetypes-text-php', 'php5' => 'mimetypes-text-php', 'php4' => 'mimetypes-text-php', 'php3' => 'mimetypes-text-php', 'inc' => 'mimetypes-text-php', 'ts' => 'mimetypes-text-ts', 'typoscript' => 'mimetypes-text-typoscript', 'txt' => 'mimetypes-text-text', 'class' => 'mimetypes-text-text', 'tmpl' => 'mimetypes-text-text', 'jpg' => 'mimetypes-media-image', 'jpeg' => 'mimetypes-media-image', 'gif' => 'mimetypes-media-image', 'png' => 'mimetypes-media-image', 'bmp' => 'mimetypes-media-image', 'tif' => 'mimetypes-media-image', 'tiff' => 'mimetypes-media-image', 'tga' => 'mimetypes-media-image', 'psd' => 'mimetypes-media-image', 'eps' => 'mimetypes-media-image', 'ai' => 'mimetypes-media-image', 'svg' => 'mimetypes-media-image', 'pcx' => 'mimetypes-media-image', 'avi' => 'mimetypes-media-video', 'mpg' => 'mimetypes-media-video', 'mpeg' => 'mimetypes-media-video', 'mov' => 'mimetypes-media-video', 'vimeo' => 'mimetypes-media-video-vimeo', 'youtube' => 'mimetypes-media-video-youtube', 'wav' => 'mimetypes-media-audio', 'mp3' => 'mimetypes-media-audio', 'ogg' => 'mimetypes-media-audio', 'flac' => 'mimetypes-media-audio', 'opus' => 'mimetypes-media-audio', 'mid' => 'mimetypes-media-audio', 'swf' => 'mimetypes-media-flash', 'swa' => 'mimetypes-media-flash', 'exe' => 'mimetypes-application', 'com' => 'mimetypes-application', 't3x' => 'mimetypes-compressed', 't3d' => 'mimetypes-compressed', 'zip' => 'mimetypes-compressed', 'tgz' => 'mimetypes-compressed', 'gz' => 'mimetypes-compressed', 'pdf' => 'mimetypes-pdf', 'doc' => 'mimetypes-word', 'dot' => 'mimetypes-word', 'docm' => 'mimetypes-word', 'docx' => 'mimetypes-word', 'dotm' => 'mimetypes-word', 'dotx' => 'mimetypes-word', 'sxw' => 'mimetypes-word', 'rtf' => 'mimetypes-word', 'xls' => 'mimetypes-excel', 'xlsm' => 'mimetypes-excel', 'xlsx' => 'mimetypes-excel', 'xltm' => 'mimetypes-excel', 'xltx' => 'mimetypes-excel', 'sxc' => 'mimetypes-excel', 'pps' => 'mimetypes-powerpoint', 'ppsx' => 'mimetypes-powerpoint', 'ppt' => 'mimetypes-powerpoint', 'pptm' => 'mimetypes-powerpoint', 'pptx' => 'mimetypes-powerpoint', 'potm' => 'mimetypes-powerpoint', 'potx' => 'mimetypes-powerpoint', 'mount' => 'apps-filetree-mount', 'folder' => 'apps-filetree-folder-default', 'default' => 'mimetypes-other-other']

$flagsInitialized

protected bool $flagsInitialized = false

$fullInitialized

protected bool $fullInitialized = false

$iconAliases

protected array<string, string> $iconAliases = []

$icons

Registered icons

protected array $icons = []

$mimeTypeMapping

Mapping of mime types to icons

protected string[] $mimeTypeMapping = ['video/*' => 'mimetypes-media-video', 'audio/*' => 'mimetyp…
Show the full value['video/*' => 'mimetypes-media-video', 'audio/*' => 'mimetypes-media-audio', 'image/*' => 'mimetypes-media-image', 'text/*' => 'mimetypes-text-text']

$staticIcons

manually registered icons hopefully obsolete one day

protected array $staticIcons = []

$tcaInitialized

protected bool $tcaInitialized = false

Methods

detectIconProvider()

Detect the IconProvider of an icon

public detectIconProvider(string $iconReference) : string

Parameters

$iconReference : string

Return values

string

getAllRegisteredIconIdentifiers()

public getAllRegisteredIconIdentifiers() : array

Return values

array

getBackendIconsCacheIdentifier()

public getBackendIconsCacheIdentifier() : string

Return values

string

getDefaultIconIdentifier()

public getDefaultIconIdentifier() : string

Return values

string

getDeprecatedIcons()

public getDeprecatedIcons() : array

Return values

array

getIconConfigurationByIdentifier()

Fetches the configuration provided by registerIcon()

public getIconConfigurationByIdentifier(string $identifier) : mixed

Parameters

$identifier : string

the icon identifier

Tags

throws
Exception

getIconIdentifierForFileExtension()

public getIconIdentifierForFileExtension(string $fileExtension) : string

Parameters

$fileExtension : string

Return values

string

getIconIdentifierForMimeType()

Get iconIdentifier for given mimeType

public getIconIdentifierForMimeType(string $mimeType) : string|null

Parameters

$mimeType : string

Return values

string|null —

Returns null if no icon is registered for the mimeType

isDeprecated()

public isDeprecated(string $identifier) : bool

Parameters

$identifier : string

Return values

bool

isRegistered()

public isRegistered(string $identifier) : bool

Parameters

$identifier : string

Return values

bool

registerAlias()

Registers an icon to be available inside the Icon Factory

public registerAlias(string $alias, string $identifier) : mixed

Parameters

$alias : string
$identifier : string

Tags

throws
InvalidArgumentException

registerFileExtension()

Register an icon for a file extension

public registerFileExtension(string $fileExtension, string $iconIdentifier) : mixed

Parameters

$fileExtension : string
$iconIdentifier : string

registerIcon()

Registers an icon to be available inside the Icon Factory

public registerIcon(string $identifier, string $iconProviderClassName[, array $options = [] ]) : mixed

Parameters

$identifier : string
$iconProviderClassName : string
$options : array = []

Tags

throws
InvalidArgumentException

registerMimeTypeIcon()

Register an icon for a mime-type

public registerMimeTypeIcon(string $mimeType, string $iconIdentifier) : mixed

Parameters

$mimeType : string
$iconIdentifier : string

getCachedBackendIcons()

Retrieve the icons from cache render them when not cached yet

protected getCachedBackendIcons() : mixed

getCachedFlagIcons()

protected getCachedFlagIcons() : void

initialize()

Initialize the registry This method can be called multiple times, depending on initialization status.

protected initialize() : mixed

In some cases e.g. TCA is not available, the method must be called multiple times.

registerBackendIcons()

Automatically find and register the core backend icons

protected registerBackendIcons() : void

registerFlags()

Register flags

protected registerFlags() : array

Return values

array

registerTCAIcons()

Load icons from TCA for each table and add them as "tcarecords-XX" to $this->icons

protected registerTCAIcons() : mixed
On this page