[BUGFIX] Respect format when rendering partial 31/40831/2
authorMathias Brodala <mbrodala@pagemachine.de>
Mon, 15 Dec 2014 11:38:04 +0000 (12:38 +0100)
committerAndreas Fernandez <typo3@scripting-base.de>
Wed, 1 Jul 2015 17:59:43 +0000 (19:59 +0200)
The request format needs to be respected when rendering partials,
otherwise the same partial cannot be rendered in different formats
in the same request.

An example is rendering mails in plain text and HTML.

Resolves: #60338
Releases: master, 6.2
Change-Id: I118ee0a535d0f06391cd802c10d7c3c5129c2a2c
Reviewed-on: http://review.typo3.org/40831
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/fluid/Classes/View/AbstractTemplateView.php

index 6a94fcd..a94451e 100644 (file)
@@ -253,10 +253,11 @@ abstract class AbstractTemplateView implements \TYPO3\CMS\Extbase\Mvc\View\ViewI
         * @return string
         */
        public function renderPartial($partialName, $sectionName, array $variables) {
-               if (!isset($this->partialIdentifierCache[$partialName])) {
-                       $this->partialIdentifierCache[$partialName] = $this->getPartialIdentifier($partialName);
+               $partialNameWithFormat = $partialName . '.' . $this->controllerContext->getRequest()->getFormat();
+               if (!isset($this->partialIdentifierCache[$partialNameWithFormat])) {
+                       $this->partialIdentifierCache[$partialNameWithFormat] = $this->getPartialIdentifier($partialName);
                }
-               $partialIdentifier = $this->partialIdentifierCache[$partialName];
+               $partialIdentifier = $this->partialIdentifierCache[$partialNameWithFormat];
 
                if ($this->templateCompiler->has($partialIdentifier)) {
                        $parsedPartial = $this->templateCompiler->get($partialIdentifier);