[BUGFIX] DocumentTemplate class inserts inDocStyles twice 48/27148/3
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Thu, 30 Jan 2014 13:09:26 +0000 (14:09 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Thu, 30 Jan 2014 13:32:33 +0000 (14:32 +0100)
Change-Id: I252da74973c3dc4157717139c95ad0605e16fce1
Releases: 6.2, 6.1, 4.5
Resolves: #55458
Reviewed-on: https://review.typo3.org/27148
Reviewed-by: Wouter Wolters
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/t3skin/Classes/Hook/StyleGenerationHook.php

index 143e3c5..504f3df 100644 (file)
@@ -1164,6 +1164,12 @@ class DocumentTemplate {
                $this->inDocStylesArray[] = $this->inDocStyles_TBEstyle;
                // Implode it all:
                $inDocStyles = implode(LF, $this->inDocStylesArray);
+
+               // Reset styles so they won't be added again in insertStylesAndJS()
+               $this->inDocStylesArray = array();
+               $this->inDocStyles = '';
+               $this->inDocStyles_TBEstyle = '';
+
                if ($this->styleSheetFile) {
                        $this->pageRenderer->addCssFile($this->backPath . $this->styleSheetFile);
                }
@@ -1225,9 +1231,12 @@ class DocumentTemplate {
         */
        public function insertStylesAndJS($content) {
                // Insert accumulated CSS
-               $this->inDocStylesArray[] = $this->inDocStyles;
+               if (!empty($this->inDocStyles)) {
+                       $this->inDocStylesArray[] = $this->inDocStyles;
+               }
                $styles = LF . implode(LF, $this->inDocStylesArray);
                $content = str_replace('/*###POSTCSSMARKER###*/', $styles, $content);
+
                // Insert accumulated JS
                $jscode = $this->JScode . LF . $this->wrapScriptTags(implode(LF, $this->JScodeArray));
                $content = str_replace('<!--###POSTJSMARKER###-->', $jscode, $content);
index 68e79ec..56dc668 100644 (file)
@@ -4,7 +4,7 @@ namespace TYPO3\CMS\T3skin\Hook;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2013-2013 Stefan Neufeind <info [at] speedpartner.de>
+ *  (c) 2014 Stefan Neufeind <info [at] speedpartner.de>
  *
  *  All rights reserved
  *