[TASK] Move backend logo rendering to fluid 63/38263/2
authorBenjamin Mack <benni@typo3.org>
Thu, 26 Mar 2015 18:05:45 +0000 (19:05 +0100)
committerAndreas Fernandez <andreas.fernandez@aspedia.de>
Thu, 26 Mar 2015 18:47:30 +0000 (19:47 +0100)
The backend logo in the left corner was rendered via it's own
simple class which can easily be replaced by Fluid and the logic
for that.

The old LogoView class is now marked for deprecation.

Resolves: #66065
Releases: master
Change-Id: Ief36fece1fcde3633cf67367153db4f75985e166
Reviewed-on: http://review.typo3.org/38263
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Andreas Fernandez <andreas.fernandez@aspedia.de>
Tested-by: Andreas Fernandez <andreas.fernandez@aspedia.de>
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/View/LogoView.php
typo3/sysext/backend/Resources/Private/Templates/Backend/Main.html
typo3/sysext/core/Documentation/Changelog/master/Deprecation-66065-BackendLogoViewDeprecated.rst [new file with mode: 0644]

index 115f299..f31c84d 100644 (file)
@@ -203,8 +203,24 @@ class BackendController {
 
                // Prepare the scaffolding, at this point extension may still add javascript and css
                $view = $this->getFluidTemplateObject($this->templatePath . 'Backend/Main.html');
-               // @todo: kick logo view class and move all logic to Fluid
-               $view->assign('logo', GeneralUtility::makeInstance(\TYPO3\CMS\Backend\View\LogoView::class)->render());
+
+               // Render the TYPO3 logo in the left corner
+               $logoUrl = $GLOBALS['TBE_STYLES']['logo'] ?: 'gfx/typo3-topbar@2x.png';
+               $logoPath = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath(PATH_typo3 . $logoUrl);
+               list($logoWidth, $logoHeight) = @getimagesize($logoPath);
+
+               // High-resolution?
+               if (strpos($logoUrl, '@2x.') !== FALSE) {
+                       $logoWidth = $logoWidth/2;
+                       $logoHeight = $logoHeight/2;
+               }
+
+               $view->assign('logoUrl', $logoUrl);
+               $view->assign('logoWidth', $logoWidth);
+               $view->assign('logoHeight', $logoHeight);
+               $view->assign('logoLink', TYPO3_URL_GENERAL);
+               $view->assign('applicationVersion', TYPO3_version);
+               $view->assign('siteName', $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']);
                $view->assign('moduleMenu', $this->generateModuleMenu());
                $view->assign('toolbar', $this->renderToolbar());
 
index 1fe26f8..f54608b 100644 (file)
@@ -18,6 +18,7 @@ namespace TYPO3\CMS\Backend\View;
  * class to render the TYPO3 logo in the backend
  *
  * @author Ingo Renner <ingo@typo3.org>
+ * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 - change the logic of the logo directly in the corresponding Fluid template
  */
 class LogoView {
 
@@ -28,8 +29,10 @@ class LogoView {
 
        /**
         * Constructor
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 - change the logic of the logo directly in the corresponding Fluid template
         */
        public function __construct() {
+               \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
                $this->logo = 'gfx/typo3-topbar@2x.png';
        }
 
index 7c8c03b..c82fc33 100644 (file)
@@ -1,6 +1,9 @@
 <div class="typo3-topbar-container" role="navigation" id="typo3-top-container">
        <div class="typo3-topbar-site">
-               <f:format.raw>{logo}</f:format.raw>
+               <a class="typo3-topbar-site-logo" href="{logoLink}" target="_blank">
+                       <img src="{logoUrl}" width="{logoWidth}" height="{logoHeight}" title="TYPO3 Content Management System" alt="" />
+               </a>
+               <span class="typo3-topbar-site-name">{siteName} [{applicationVersion}]</span>
        </div>
        <div class="typo3-topbar-navigation" id="typo3-topbar-navigation">
                <ul class="typo3-topbar-navigation-items" data-typo3-role="typo3-module-menu">
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-66065-BackendLogoViewDeprecated.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-66065-BackendLogoViewDeprecated.rst
new file mode 100644 (file)
index 0000000..06cb839
--- /dev/null
@@ -0,0 +1,29 @@
+==================================================
+Deprecation - #66065: Backend Logo View Deprecated
+==================================================
+
+Description
+===========
+
+The logo view class responsible for the rendering of the TYPO3 Logo in the left corner of the backend is not in use
+anymore and marked for deprecation. The logic for exchanging the logo via TBE_STYLES is still available.
+
+
+Impact
+======
+
+Installations extending ``TYPO3\CMS\Backend\View\LogoView`` as an XCLASS will not see
+any modified output instead.
+
+
+Affected Installations
+======================
+
+Installations extending ``TYPO3\CMS\Backend\View\LogoView`` as an XCLASS.
+
+
+Migration
+=========
+
+As the same logic is now done in the BackendController and the main Backend Fluid Template, the template can be
+modified to fit the installations' needs.