From 62d40fca258e89fb19504c51eb1c60a4935e0654 Mon Sep 17 00:00:00 2001
From: Benni Mack <benni@typo3.org>
Date: Thu, 21 Dec 2017 17:31:34 +0100
Subject: [PATCH] [BUGFIX] Add support for PNG icons of the SVG Tree

When the pagetree (base on SVG tree) is having a custom icon based on a PNG
like a custom page tree icon, then the SVG tree does not show anything.

The patch fixes the SVG tree to support rendering of PNG icons.

Resolves: #83410
Releases: master
Change-Id: Ifdcc827bc073da4b8eabcc209d03ce55d8f0c94f
Reviewed-on: https://review.typo3.org/55192
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
---
 .../backend/Resources/Public/JavaScript/SvgTree.js    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js b/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js
index aa6150c4a9b2..da64e03b3cc5 100644
--- a/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js
+++ b/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js
@@ -437,7 +437,16 @@ define(
             icon: '',
           };
           Icons.getIcon(iconName, Icons.sizes.small, null, null, 'inline').done(function (icon) {
-            _this.data.icons[iconName].icon = icon.match(/<svg[\s\S]*<\/svg>/i)[0];
+            var result = icon.match(/<svg[\s\S]*<\/svg>/i);
+
+            // Check if the icon is from the Bitmap Icon Provider (see PHP class for the inline rendering)
+            if (!result) {
+              result = icon.match(/<image[\s\S]*\/>/i);
+            }
+
+            if (result) {
+              _this.data.icons[iconName].icon = result[0];
+            }
 
             if (update) {
               _this.update();
-- 
GitLab