[!!!][FEATURE] Make BE favicon configurable via Extension manager 02/49202/8
authorGeorg Ringer <georg.ringer@gmail.com>
Tue, 26 Jul 2016 08:18:32 +0000 (10:18 +0200)
committerBenni Mack <benni@typo3.org>
Tue, 23 Aug 2016 19:54:53 +0000 (21:54 +0200)
Make the path to the favicon configurable in the Extension Manager instead
of the TBE_STYLES.

Releases: master
Resolves: #77481
Change-Id: I6162b031b13077ea9c06d54754f58e09f6a1bce5
Reviewed-on: https://review.typo3.org/49202
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/backend/Resources/Private/Language/locallang.xlf
typo3/sysext/backend/ext_conf_template.txt
typo3/sysext/core/Documentation/Changelog/master/Breaking-77481-RemoveFaviconFromTBE_STYLES.rst [new file with mode: 0644]
typo3/sysext/core/Documentation/Changelog/master/Feature-77481-AddPossibilityToDefineAFaviconForTheBackend.rst [new file with mode: 0644]

index 18c6eaf..8dd75d6 100644 (file)
@@ -1511,6 +1511,39 @@ function jumpToUrl(URL) {
     */
     protected function getBackendFavicon()
     {
-        return PathUtility::getAbsoluteWebPath($GLOBALS['TBE_STYLES']['favicon'] ?: ExtensionManagementUtility::extPath('backend') . 'Resources/Public/Icons/favicon.ico');
+        $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['backend'], ['allowed_classes' => false]);
+
+        if (!empty($extConf['backendFavicon'])) {
+            $path =  $this->getUriForFileName($extConf['backendFavicon']);
+        } else {
+            $path = ExtensionManagementUtility::extPath('backend') . 'Resources/Public/Icons/favicon.ico';
+        }
+        return PathUtility::getAbsoluteWebPath($path);
+    }
+
+    /**
+     * Returns the uri of a relative reference, resolves the "EXT:" prefix
+     * (way of referring to files inside extensions) and checks that the file is inside
+     * the PATH_site of the TYPO3 installation
+     *
+     * @param string $filename The input filename/filepath to evaluate
+     * @return string Returns the filename of $filename if valid, otherwise blank string.
+     */
+    protected function getUriForFileName($filename)
+    {
+        if (strpos($filename, '://')) {
+            return $filename;
+        }
+        $urlPrefix = '';
+        if (strpos($filename, 'EXT:') === 0) {
+            $absoluteFilename = GeneralUtility::getFileAbsFileName($filename);
+            $filename = '';
+            if ($absoluteFilename !== '') {
+                $filename = PathUtility::getAbsoluteWebPath($absoluteFilename);
+            }
+        } elseif (strpos($filename, '/') !== 0) {
+            $urlPrefix = GeneralUtility::getIndpEnv('TYPO3_SITE_PATH');
+        }
+        return $urlPrefix . $filename;
     }
 }
index b91a1cc..5387089 100644 (file)
@@ -31,6 +31,9 @@ Have a nice day.</source>
                        <trans-unit id="config.backendLogo">
                                <source>Logo: If set, this logo will be used instead of the TYPO3 logo in the TYPO3 Backend in the left top corner (e.g. fileadmin/images/backend-logo.png or EXT:my_theme/Resources/Public/Images/backend-logo.png</source>
                        </trans-unit>
+                       <trans-unit id="config.backendFavicon">
+                               <source>Favicon: If set, this favicon will be used instead of the TYPO3 logo (e.g. EXT:my_theme/Resources/Public/Images/favicon.ico)</source>
+                       </trans-unit>
                        <trans-unit id="foldertreeview.noFolders.title">
                                <source>No folders available</source>
                        </trans-unit>
index 5ff1483..9099147 100644 (file)
@@ -13,3 +13,6 @@ loginBackgroundImage =
 
 # cat=Backend; type=string; label=LLL:EXT:backend/Resources/Private/Language/locallang.xlf:config.backendLogo
 backendLogo =
+
+# cat=Backend; type=string; label=LLL:EXT:backend/Resources/Private/Language/locallang.xlf:config.backendFavicon
+backendFavicon =
\ No newline at end of file
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-77481-RemoveFaviconFromTBE_STYLES.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-77481-RemoveFaviconFromTBE_STYLES.rst
new file mode 100644 (file)
index 0000000..8945ec8
--- /dev/null
@@ -0,0 +1,26 @@
+=================================================
+Breaking: #77481 - Remove favicon from TBE_STYLES
+=================================================
+
+Description
+===========
+
+The configuration :php:``$GLOBALS['TBE_STYLES']['favicon']`` has been removed.
+
+
+Impact
+======
+
+The configuration :php:``$GLOBALS['TBE_STYLES']['favicon']`` is not evaluated anymore.
+
+
+Affected Installations
+======================
+
+Any installation using :php:``$GLOBALS['TBE_STYLES']['favicon']``.
+
+
+Migration
+=========
+
+Define the favicon in the setting of the extension "backend" in the extension manager.
\ No newline at end of file
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-77481-AddPossibilityToDefineAFaviconForTheBackend.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-77481-AddPossibilityToDefineAFaviconForTheBackend.rst
new file mode 100644 (file)
index 0000000..14a9342
--- /dev/null
@@ -0,0 +1,10 @@
+=====================================================================
+Feature: #77481 - Add possibility to define a favicon for the backend
+=====================================================================
+
+Description
+===========
+
+The new option ``backendFavicon`` in the extension manager configuration makes it possible to
+change the favicon of the backend. This makes it easier to distinguish between different
+installations and stages.
\ No newline at end of file