typo3-rector
typo3-rector copied to clipboard
Deprecation: #102895 - ExtensionManagementUtility::getExtensionIcon
Deprecation: #102895 - ExtensionManagementUtility::getExtensionIcon
https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.0/Deprecation-102895-ExtensionManagementUtilitygetExtensionIcon.html
title: "Deprecation: #102895 - ExtensionManagementUtility::getExtensionIcon"
See 102895
Description
The PHP method
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionIcon
has been deprecated in favor of
\TYPO3\CMS\Core\Package\Package->getPackageIcon
.
Impact
Calling the method
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionIcon
will trigger a PHP deprecation warning.
Affected installations
TYPO3 installations with custom extensions calling the method.
Migration
Migrate towards the PackageManager
implementation, which can be added
via Dependency Injection or retrieved via
GeneralUtility::makeInstance()
.
Before
$iconPathInPackage = ExtensionManagementUtility::getExtensionIcon($extensionKey);
$fullIconPath = ExtensionManagementUtility::getExtensionIcon($extensionKey, true);
After
$packageManager = GeneralUtility::makeInstance(PackageManager::class);
$package = $packageManager->getPackage($extensionKey);
if ($package->getPackageIcon()) {
$iconPathInPackage = $package->getPackageIcon();
$fullIconPath = $package->getPackagePath() . $package->getPackageIcon();
}
PHP-API, FullyScanned, ext:core