From d967c381ab9a4db27970b1ae1e02d2c6742181ef Mon Sep 17 00:00:00 2001 From: Georg Ringer <georg.ringer@gmail.com> Date: Tue, 26 Jul 2016 10:18:32 +0200 Subject: [PATCH] [!!!][FEATURE] Make BE favicon configurable via Extension manager 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> --- .../Classes/Template/DocumentTemplate.php | 35 ++++++++++++++++++- .../Resources/Private/Language/locallang.xlf | 3 ++ typo3/sysext/backend/ext_conf_template.txt | 3 ++ ...king-77481-RemoveFaviconFromTBE_STYLES.rst | 26 ++++++++++++++ ...ssibilityToDefineAFaviconForTheBackend.rst | 10 ++++++ 5 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Breaking-77481-RemoveFaviconFromTBE_STYLES.rst create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Feature-77481-AddPossibilityToDefineAFaviconForTheBackend.rst diff --git a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php index 18c6eafcd75d..8dd75d65185e 100644 --- a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php +++ b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php @@ -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; } } diff --git a/typo3/sysext/backend/Resources/Private/Language/locallang.xlf b/typo3/sysext/backend/Resources/Private/Language/locallang.xlf index b91a1cc3b9f0..5387089f5e1b 100644 --- a/typo3/sysext/backend/Resources/Private/Language/locallang.xlf +++ b/typo3/sysext/backend/Resources/Private/Language/locallang.xlf @@ -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> diff --git a/typo3/sysext/backend/ext_conf_template.txt b/typo3/sysext/backend/ext_conf_template.txt index 5ff148350eba..9099147b635a 100644 --- a/typo3/sysext/backend/ext_conf_template.txt +++ b/typo3/sysext/backend/ext_conf_template.txt @@ -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 index 000000000000..8945ec8aa06c --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-77481-RemoveFaviconFromTBE_STYLES.rst @@ -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 index 000000000000..14a934264c69 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-77481-AddPossibilityToDefineAFaviconForTheBackend.rst @@ -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 -- GitLab