IconRegistry implements SingletonInterface

Class IconRegistry, 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

$backendIconAllowedExtensionsWithProvider  : array<string|int, string>
List of allowed icon file extensions with their Provider class
$backendIconDeclaration  : string
$backendIconsInitialized  : bool
$cache  : FrontendInterface
$defaultIconIdentifier  : string
$deprecatedIcons  : array<string|int, mixed>
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  : array<string|int, string>
Mapping of file extensions to mimetypes
$flagsInitialized  : bool
$fullInitialized  : bool
$iconAliases  : array<string, string>
$icons  : array<string|int, mixed>
Registered icons
$mimeTypeMapping  : array<string|int, string>
Mapping of mime types to icons
$moduleIconsInitialized  : bool
$staticIcons  : array<string|int, mixed>
manually registered icons hopefully obsolete one day
$tcaInitialized  : bool

Methods

__construct()  : mixed
detectIconProvider()  : string
Detect the IconProvider of an icon
getAllRegisteredIconIdentifiers()  : array<string|int, mixed>
getBackendIconsCacheIdentifier()  : string
getDefaultIconIdentifier()  : string
getDeprecatedIcons()  : array<string|int, mixed>
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
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()  : mixed
Register flags
registerModuleIcons()  : mixed
Register module icons
registerTCAIcons()  : mixed
Load icons from TCA for each table and add them as "tcarecords-XX" to $this->icons

Properties

$backendIconAllowedExtensionsWithProvider

List of allowed icon file extensions with their Provider class

protected array<string|int, string> $backendIconAllowedExtensionsWithProvider = ['png' => \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class, 'svg' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class]

$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

Deprecated

These icons will be removed in TYPO3 v12

protected array<string|int, mixed> $deprecatedIcons = []

Example: [ 'deprecated-icon-identifier' => 'new-icon-identifier', 'another-deprecated-identifier' => null, ]

$fileExtensionMapping

Mapping of file extensions to mimetypes

protected array<string|int, string> $fileExtensionMapping = ['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<string|int, mixed> $icons = []

$mimeTypeMapping

Mapping of mime types to icons

protected array<string|int, string> $mimeTypeMapping = ['video/*' => 'mimetypes-media-video', 'audio/*' => 'mimetypes-media-audio', 'image/*' => 'mimetypes-media-image', 'text/*' => 'mimetypes-text-text']

$moduleIconsInitialized

protected bool $moduleIconsInitialized = false

$staticIcons

manually registered icons hopefully obsolete one day

protected array<string|int, mixed> $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<string|int, mixed>
Return values
array<string|int, mixed>

getBackendIconsCacheIdentifier()

public getBackendIconsCacheIdentifier() : string
Internal
Return values
string

getDefaultIconIdentifier()

public getDefaultIconIdentifier() : string
Return values
string

getDeprecatedIcons()

public getDeprecatedIcons() : array<string|int, mixed>
Return values
array<string|int, mixed>

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<string|int, mixed> $options = [] ]) : mixed
Parameters
$identifier : string
$iconProviderClassName : string
$options : array<string|int, mixed> = []
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

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() : mixed

registerModuleIcons()

Register module icons

protected registerModuleIcons() : mixed

registerTCAIcons()

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

protected registerTCAIcons() : mixed

        
On this page

Search results