Bug #82196
closedCan no longer configure diverging templateRootPaths for the view of each plugin in an extension
100%
Description
Up until including TYPO3 7.6 it was possible to configure different templateRootPaths for the views of each plugin within an extension.
For example, with the following configuration ...
plugin.tx_extensionName { view { templateRootPaths { 0 = EXT:extensionName/Resources/Private/Templates/ } partialRootPaths { 0 = EXT:extensionName/Resources/Private/Partials/ } layoutRootPaths { 0 = EXT:extensionName/Resources/Private/Layouts/ } } } plugin.tx_extensionName_pluginName { view { templateRootPaths { 0 = EXT:extensionName/Resources/Private/Templates/ 1 = EXT:extensionName/Resources/Private/PluginName/Templates/ } partialRootPaths { 0 = EXT:extensionName/Resources/Private/PluginName/ 1 = EXT:extensionName/Resources/Private/PluginName/Partials/ } layoutRootPaths { 0 = EXT:extensionName/Resources/Private/Layouts/ 1 = EXT:extensionName/Resources/Private/PluginName/Layouts/ } } }
... you would get the plugin "PluginName" to use their own template path and fall back to the templates/partials in the default partial root path.
This is no longer possible due to a change in \TYPO3\CMS\Fluid\View\AbstractTemplateView:
Before this line, the templateRootPaths are configured correctly. When the templateRootPaths are reinitialized by \TYPO3Fluid\Fluid\View\TemplatePaths::fillDefaultsByPackageName, the configuration within plugin.tx_extensionName.view is used without taking plugin.tx_extensionName_pluginName into account.
Granted, this is a rather special use case, but it was helpful if you were required to change only some of the templates or partials in a plugin and wanted to reuse most of the resources of another plugin. Also, the old behaviour was much more consistent with the overall Typoscript configuration of extbase plugins where you can also, for example, configure different storagePids for each plugin.
I couldn't find a breaking change remark in the changelog so I don't think this is intended?
regards
Thomas
Updated by RVVN no-lastname-given about 7 years ago
- Related to Bug #82181: Cannot override plugin view.templateRootPaths because of cache added
Updated by Thomas Prangenberg about 7 years ago
Actually, I digged a bit deeper and it seems like the configuration of the view is not even used at all when \TYPO3\CMS\Fluid\View\TemplateView::canRender is invoked.
Does that mean it is no longer possible to overwrite the default template root path of an extbase plugin to something that does not fit the nameing convention ("Resources/Private/Templates/")? Doesn't that make the configuration in TypoScript (at least configuration of the default paths) kind of pointless?
Updated by Claus Due about 7 years ago
I couldn't find a breaking change remark in the changelog so I don't think this is intended?
No, this was not intended. Seems it was forgotten during the replacement and there was no similar concept in the old Fluid package the new one was built from.
The reason $paths->fillDefaultsByPackageName($extensionKeyFromRequest) gets used is simply to save a rather significant chunk of code in the CMS AbstractTemplateView IIRC. TemplatePaths itself only knows about the extension scope (there is no concept of "plugins" in Fluid itself) and the API implies that if this secondary scope has to be supported, then the TS paths must be resolved externally and set in TemplatePaths using the fillFromConfigurationArray method instead. And, I presume, it must combine those paths with any paths that are defined in the extension scope, giving the plugin-scope ones priority.
It's going to require a little refactoring. Maybe you can use this info to come up with a change that fixes this? :)
Does that mean it is no longer possible to overwrite the default template root path of an extbase plugin to something that does not fit the nameing convention(?)
No, it just means you have to add those paths to the extension view paths scope instead. If you wish, you can also completely remove the default lookup paths. The one thing you can't do because see above, is target a specific plugin by name.
Updated by Gerrit Code Review about 7 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53872
Updated by Gerrit Code Review about 7 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53872
Updated by Claus Due about 7 years ago
@Thomas could I get you to try the linked core patch if that solves the problem for you? Don't forget to vote on Gerrit ;)
Updated by Gerrit Code Review about 7 years ago
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53917
Updated by Gerrit Code Review about 7 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53917
Updated by Gerrit Code Review about 7 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53917
Updated by Gerrit Code Review about 7 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53917
Updated by Gerrit Code Review about 7 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53917
Updated by Gerrit Code Review about 7 years ago
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53932
Updated by Anonymous about 7 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 30c467196034ffdedc35e4be205ab4acec28a8c6.
Updated by David Frerich about 7 years ago
There is another problem with this issue that is not resolved and still exists.
Overriding the view configuration with flexforms is not possible anymore, because the Configuration provided by the extbase controller and set with "setViewConfiguration" is overwritten with the method "getContextSpecificViewConfiguration".
I think the Method fillDefaultsByPackageName should not be called or be additive / merged, if a Extbase Controller set the view configuration beforehand.
The Method setViewConfiguration in \TYPO3\CMS\Extbase\Mvc\Controller\ActionController is now without use.
Updated by Benni Mack about 7 years ago
- Related to Task #82487: Revert TemplatePaths optimizations and regressions added
Updated by Claus Due about 7 years ago
- Status changed from Resolved to Under Review
Updated by Susanne Moog over 5 years ago
- Status changed from Under Review to Needs Feedback
The patch has been applied, reverted and fixed differently. Therefor please check whether this issue still persists.
Updated by Georg Ringer over 4 years ago
- Status changed from Needs Feedback to Closed
closed as has been solved and lack of feedback. feel free to reopen if still valid