Project

General

Profile

Actions

Bug #98200

closed

Fluid does not apply stdWrap to templateRootPaths

Added by Stefan Froemken over 1 year ago. Updated 10 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
Start date:
2022-08-24
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hello Fluid Team,

in documentation I found a pretty cool information for templateRootPaths:

https://docs.typo3.org/m/typo3/reference-typoscript/10.4/en-us/ContentObjects/Fluidtemplate/Index.html#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

Actions #1

Updated by Oliver Hader over 1 year 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

Actions #2

Updated by Oliver Hader over 1 year ago

  • Status changed from New to Needs Feedback
Actions #3

Updated by Stefan Froemken over 1 year 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

Actions #4

Updated by Stefan Bürk over 1 year 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).

Actions #5

Updated by Chris Müller over 1 year ago

The stdWrap functionality ("1.") cannot be used together with a dedicated path ("1"), so in your example the "1." part is ignored:

https://github.com/TYPO3/typo3/blob/35785561b0fb3e52a544aa558ea4cc76513235c6/typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php#L370

I will take care of adjusting the documentation.

Actions #6

Updated by Chris Müller over 1 year 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}
}
Actions #8

Updated by Simon Praetorius 10 months 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

Actions #9

Updated by Simon Praetorius 10 months ago

  • Status changed from Needs Feedback to Resolved

The best practice to use conditions here has been added to the documentation.

Actions

Also available in: Atom PDF