Bug #98200
closedFluid does not apply stdWrap to templateRootPaths
0%
Description
Hello Fluid Team,
in documentation I found a pretty cool information for templateRootPaths:
Quote "Data type: array of file paths with stdWrap"
I just used it that way:
templateRootPaths { 0 = EXT:events2/Resources/Private/Templates/ 1 = EXT:events2/Resources/Private/Templates/Overrides/ 1.if.isTrue = {$plugin.tx_events2.settings.useExtForm} 2 = {$plugin.tx_events2.view.templateRootPath} }
But frontend results in:
(1/1) #1476107295 TYPO3\CMS\Core\Error\Exception PHP Warning: rtrim() expects parameter 1 to be string, array given in /var/www/html/vendor/typo3fluid/fluid/src/View/TemplatePaths.php line 468
Nice greetings
Stefan
Updated by Oliver Hader about 2 years ago
Side-note: Just in case that just docs are wrong, please keep it like that. Using stdWrap
on declarative settings like paths, which are processed by other components (e.g. Fluid), is not a good idea...
Something like this seems to be more explicit (avoiding to use stdWrap
, but utilizing TypoScript constants):
[{$plugin.tx_events2.settings.useExtForm}] plugin.whatever.view { templateRootPaths.1 = EXT:events2/Resources/Private/Templates/Overrides/ } [end]
But actually that might be defined on a site-level, e.g. like https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Conditions/Index.html#id56
Updated by Oliver Hader about 2 years ago
- Status changed from New to Needs Feedback
Updated by Stefan Froemken about 2 years ago
Hi Olli,
I just have solved it that way.
For me it's not a problem, if these 3 sections (for layout*, partials* and templateRootPaths) will be removed from documentation.
Stefan
Updated by Stefan Bürk about 2 years ago
I guess that removing them from documentation is not a good solution. At least, the statement "stdWrap" shouldb removed and emphasized that stdWrap should not be used for these (as noteice or something like that).
Updated by Chris Müller about 2 years ago
The stdWrap functionality ("1.") cannot be used together with a dedicated path ("1"), so in your example the "1." part is ignored:
I will take care of adjusting the documentation.
Updated by Chris Müller about 2 years ago
So, this works:
templateRootPaths { 1.cObject = TEXT 1.cObject.value = EXT:events2/Resources/Private/Templates/Overrides/ 1.cObject.if.isTrue = {$plugin.tx_events2.settings.useExtForm} }
Updated by Chris Müller about 2 years ago
Updated by Simon Praetorius over 1 year ago
I added another PR since the last one didn't make it into the documentation:
https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-Typoscript/pull/758
Updated by Simon Praetorius over 1 year ago
- Status changed from Needs Feedback to Resolved
The best practice to use conditions here has been added to the documentation.