[BUGFIX] Respect format when rendering partial 75/35475/4
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:55:50 +0000 (19:55 +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/35475
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/fluid/Classes/View/AbstractTemplateView.php

index 70e05a8..7ace7eb 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);