diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php index 469fbf51d66ea2069144495095b89e8d90972b6f..287c1a217c8750bcda961a2d09a41eb4cddfc373 100644 --- a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php @@ -102,7 +102,7 @@ class SelectCheckBoxElement extends AbstractFormElement 'checked' => $checked, 'disabled' => false, 'class' => '', - 'icon' => (!empty($p[2]) ? FormEngineUtility::getIconHtml($p[2]) : $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render()), + 'icon' => FormEngineUtility::getIconHtml(!empty($p[2]) ? $p[2] : 'empty-empty'), 'title' => htmlspecialchars($p[0], ENT_COMPAT, 'UTF-8', false), 'help' => $help ); diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php index 7d815e98d8defd2aab58a09e2fb5bbc89c5b3dea..827fff635971eef7671bbebf1ec0093bda4a716d 100644 --- a/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php +++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php @@ -316,10 +316,6 @@ abstract class AbstractItemProvider } else { $icon = $loadModules->modules[$theMod]['iconIdentifier']; } - if ($icon) { - $iconFactory = GeneralUtility::makeInstance(IconFactory::class); - $icon = $iconFactory->getIcon($icon)->render(); - } // Add help text $helpText = [ 'title' => $languageService->moduleLabels['labels'][$theMod . '_tablabel'], @@ -386,7 +382,7 @@ abstract class AbstractItemProvider foreach ($fileArray as $fileReference) { $fileInformation = pathinfo($fileReference); $icon = GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], strtolower($fileInformation['extension'])) - ? '../' . PathUtility::stripPathSitePrefix($fileFolder) . $fileReference + ? $fileFolder . $fileReference : ''; $items[] = [ $fileReference, diff --git a/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php b/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php index a707590de8d94ad6799ebc044448a7567fcf0de6..7c5c215f67be5a6e033d310e16be7c2332ec7f62 100644 --- a/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php +++ b/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php @@ -123,33 +123,19 @@ class FormEngineUtility public static function getIconHtml($icon, $alt = '', $title = '') { $icon = (string)$icon; - $iconFile = ''; - $iconInfo = false; + $absoluteFilePath = GeneralUtility::getFileAbsFileName($icon); + if (!empty($absoluteFilePath) && is_file($absoluteFilePath)) { + $iconInfo = StringUtility::endsWith($absoluteFilePath, '.svg') + ? true + : getimagesize($absoluteFilePath); - if (StringUtility::beginsWith($icon, 'EXT:')) { - $absoluteFilePath = GeneralUtility::getFileAbsFileName($icon); - if (!empty($absoluteFilePath) && is_file($absoluteFilePath)) { - $iconFile = '../' . PathUtility::stripPathSitePrefix($absoluteFilePath); - $iconInfo = (StringUtility::endsWith($absoluteFilePath, '.svg')) - ? true - : getimagesize($absoluteFilePath); + if ($iconInfo !== false) { + return '<img' + . ' src="' . htmlspecialchars(PathUtility::getAbsoluteWebPath($absoluteFilePath)) . '"' + . ' alt="' . htmlspecialchars($alt) . '" ' + . ($title ? 'title="' . htmlspecialchars($title) . '"' : '') + . ' />'; } - } elseif (StringUtility::beginsWith($icon, '../')) { - // @TODO: this is special modList, files from folders and selicon - $iconFile = GeneralUtility::resolveBackPath($icon); - if (is_file(PATH_site . GeneralUtility::resolveBackPath(substr($icon, 3)))) { - $iconInfo = (StringUtility::endsWith($icon, '.svg')) - ? true - : getimagesize((PATH_site . GeneralUtility::resolveBackPath(substr($icon, 3)))); - } - } - - if ($iconInfo !== false && is_file(GeneralUtility::resolveBackPath(PATH_typo3 . $iconFile))) { - return '<img' - . ' src="' . htmlspecialchars($iconFile) . '"' - . ' alt="' . htmlspecialchars($alt) . '" ' - . ($title ? 'title="' . htmlspecialchars($title) . '"' : '') - . ' />'; } $iconFactory = GeneralUtility::makeInstance(IconFactory::class); diff --git a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectItemsTest.php b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectItemsTest.php index 39b6879354bd539a859083762bee67152f889060..9cd78008ee9b57b34f2ec0e7f3c77f91744e6be3 100644 --- a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectItemsTest.php +++ b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectItemsTest.php @@ -1085,7 +1085,7 @@ class TcaSelectItemsTest extends UnitTestCase 0 => [ 0 => 'aModuleLabel', 1 => 'aModule', - 2 => '<span class="t3js-icon icon icon-size-default icon-state-default icon-empty-empty" data-identifier="empty-empty"><span class="icon-markup"><span class="icon-unify"><i class="fa fa-empty-empty"></i></span></span></span>', + 2 => 'empty-empty', 3 => [ 'title' => 'aModuleTabLabel', 'description' => 'aModuleTabDescription', @@ -1139,13 +1139,13 @@ class TcaSelectItemsTest extends UnitTestCase 0 => [ 0 => 'anImage.gif', 1 => 'anImage.gif', - 2 => '../' . $directory . 'anImage.gif', + 2 => PATH_site . $directory . 'anImage.gif', 3 => null, ], 1 => [ 0 => 'subdir/anotherImage.gif', 1 => 'subdir/anotherImage.gif', - 2 => '../' . $directory . 'subdir/anotherImage.gif', + 2 => PATH_site . $directory . 'subdir/anotherImage.gif', 3 => null, ], ]; diff --git a/typo3/sysext/core/Classes/Imaging/IconRegistry.php b/typo3/sysext/core/Classes/Imaging/IconRegistry.php index 544514683c34cc56f9a288e2923faecceda22d51..c5802fe95357dd2d941d7e531cc3d63837f6ef25 100644 --- a/typo3/sysext/core/Classes/Imaging/IconRegistry.php +++ b/typo3/sysext/core/Classes/Imaging/IconRegistry.php @@ -2850,20 +2850,12 @@ class IconRegistry implements SingletonInterface // This method is only needed for TCA tables where typeicon_classes are not configured if (is_array($GLOBALS['TCA'][$tableName])) { $tcaCtrl = $GLOBALS['TCA'][$tableName]['ctrl']; - $icon = null; $iconIdentifier = 'tcarecords-' . $tableName . '-default'; if (isset($this->icons[$iconIdentifier])) { continue; } if (isset($tcaCtrl['iconfile'])) { - if (StringUtility::beginsWith($tcaCtrl['iconfile'], 'EXT:')) { - $icon = $tcaCtrl['iconfile']; - } elseif (strpos($tcaCtrl['iconfile'], '/') !== false) { - $icon = TYPO3_mainDir . GeneralUtility::resolveBackPath($tcaCtrl['iconfile']); - } - if ($icon !== null) { - $resultArray[$iconIdentifier] = $icon; - } + $resultArray[$iconIdentifier] = $tcaCtrl['iconfile']; } } }