sabbelasichon / typo3-rector

Rector for TYPO3
MIT License
229 stars 63 forks source link

Feature: #94692 - Registering Icons via Service Container #4423

Open simonschaufi opened 16 hours ago

simonschaufi commented 16 hours ago

Feature: #94692 - Registering Icons via Service Container

https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.4/Feature-94692-RegisteringIconsViaServiceContainer.html

Feature: #94692 - Registering Icons via Service Container

See 94692

Description

Extensions can now register their custom icons via a configuration file placed in Configuration/Icons.php of their extension directory, e.g. typo3conf/ext/my_extension/Configuration/Icons.php.

Each file needs to return a flat PHP configuration array, with custom options used for the IconRegistry to register a new icon.

Example:

<?php
return [
    'myicon' => [
        'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
        'source' => 'EXT:my_extension/Resources/Public/Icons/myicon.svg'
    ],
    'anothericon' => [
        'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
        'source' => 'EXT:my_extension/Resources/Public/Icons/anothericon.svg'
    ],
    ...
];

Impact

Using the new approach improves the loading speed of every request as the registration can be handled at once and cached during warmup of the core caches.

In addition, extension authors' ext_localconf.php files are drastically reduced, as extension authors have a better overview and a better separation of concerns when registering custom functionality.

PHP-API, ext:core
simonschaufi commented 15 hours ago

Resolved with #2830