Actions
Bug #60338
closedChanging view format does not affect partial format
Start date:
2014-07-15
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
Remote Sprint
Description
When using one view object to render a template in different formats (e.g. email in text and HTML), the template respects the requested format. However, partials are always rendered in the first rendered format. Example:
Content of templates/partials:
Content of Foo.txt
:
Hello <f:render partial="Bar"/>
Content of Partials/Bar.txt
:
World
Content of Foo.html
:
<p>Text</p> <f:render partial="Bar"/>
Content of Partials/Bar.html
:
<p>World</p>
1st invocation:
// Let $view be an instance of \TYPO3\CMS\Fluid\View\TemplateView $view->setFormat('txt'); $view->render('Foo');
Result:
Hello World
2nd invocation:
// $view is the same instance as above $view->setFormat('html'); $view->render('Foo');
Result:
<p>Hello</p> World
As you can see, the 2nd output was rendered using the txt-Partial.
This is due to the local partial identifier cache in AbstractTemplateView
which only considers the partial name, not the current request format. If that one is incorporated, separate cache entries for each partial formats are created.
Actions