From a8245ead32b1184b17c2560ae3fcfe6a5d34906d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Frank=20Na=CC=88gler?= <frank.naegler@typo3.org>
Date: Fri, 2 Oct 2015 12:39:33 +0200
Subject: [PATCH] [BUGFIX] Register missing icons and fix spriteicon
 registration

This patch register some missing icons and fix the automatic
registration for sprite icons which path starts with sysext/.

Resolves: #70305
Releases: master
Change-Id: If935c74046118d75160f093c8fee1a05164620fd
Reviewed-on: http://review.typo3.org/43737
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
---
 .../core/Classes/Imaging/IconRegistry.php     | 36 +++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/core/Classes/Imaging/IconRegistry.php b/typo3/sysext/core/Classes/Imaging/IconRegistry.php
index f0d644ce22d9..ae28b2b236d5 100644
--- a/typo3/sysext/core/Classes/Imaging/IconRegistry.php
+++ b/typo3/sysext/core/Classes/Imaging/IconRegistry.php
@@ -1781,7 +1781,32 @@ class IconRegistry implements \TYPO3\CMS\Core\SingletonInterface {
 			'options' => array(
 				'source' => 'EXT:core/Resources/Public/Icons/Flags/wales.png'
 			)
-		)
+		),
+
+		'tcarecords-sys_domain-default' => array(
+			'provider' => SvgIconProvider::class,
+			'options' => array(
+				'source' => 'EXT:backend/Resources/Public/Icons/Overlay/overlay-translated.svg'
+			)
+		),
+		'tcarecords-sys_template-default' => array(
+			'provider' => BitmapIconProvider::class,
+			'options' => array(
+				'source' => 'EXT:t3skin/images/icons/mimetypes/x-content-template.png'
+			)
+		),
+		'tcarecords-sys_workspace-default' => array(
+			'provider' => BitmapIconProvider::class,
+			'options' => array(
+				'source' => 'EXT:t3skin/images/icons/mimetypes/x-sys_workspace.png'
+			)
+		),
+		'tcarecords-sys_workspace_stage-default' => array(
+			'provider' => BitmapIconProvider::class,
+			'options' => array(
+				'source' => 'EXT:t3skin/images/icons/mimetypes/x-sys_workspace.png'
+			)
+		),
 	);
 
 	/**
@@ -2034,6 +2059,10 @@ class IconRegistry implements \TYPO3\CMS\Core\SingletonInterface {
 			if (is_array($GLOBALS['TCA'][$tableName])) {
 				$tcaCtrl = $GLOBALS['TCA'][$tableName]['ctrl'];
 				$icon = NULL;
+				$iconIdentifier = 'tcarecords-' . $tableName . '-default';
+				if ($this->isRegistered($iconIdentifier)) {
+					continue;
+				}
 				if (isset($tcaCtrl['iconfile'])) {
 					if (StringUtility::beginsWith($tcaCtrl['iconfile'], 'EXT:')) {
 						$icon = $tcaCtrl['iconfile'];
@@ -2041,7 +2070,7 @@ class IconRegistry implements \TYPO3\CMS\Core\SingletonInterface {
 						$icon = TYPO3_mainDir . GeneralUtility::resolveBackPath($tcaCtrl['iconfile']);
 					}
 					if ($icon !== NULL) {
-						$resultArray['tcarecords-' . $tableName . '-default'] = $icon;
+						$resultArray[$iconIdentifier] = $icon;
 					}
 				}
 			}
@@ -2051,6 +2080,9 @@ class IconRegistry implements \TYPO3\CMS\Core\SingletonInterface {
 				if (StringUtility::beginsWith($iconFile, '../typo3conf/ext/')) {
 					$iconFile = str_replace('../typo3conf/ext/', 'EXT:', $iconFile);
 				}
+				if (StringUtility::beginsWith($iconFile, 'sysext/')) {
+					$iconFile = str_replace('sysext/', 'EXT:', $iconFile);
+				}
 				$resultArray[$iconIdentifier] = $iconFile;
 			}
 		}
-- 
GitLab