Issue Bug Closed

#98200Fluid does not apply stdWrap to templateRootPaths

Stefan Froemken 08/24/22, 14:17 updated 07/09/24, 12:46

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

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 10

  1. Oliver Hader commented 08/25/22, 08:17

    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

  2. Oliver Hader changed status New Needs Feedback 08/25/22, 08:23

  3. Stefan Froemken commented 08/25/22, 10:03

    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

  4. Stefan Bürk commented 08/25/22, 22:30

    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).

  5. Chris Müller commented 08/26/22, 16:13

    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.

  6. Chris Müller commented 08/26/22, 16:21

    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}
    }
  7. Simon Praetorius commented 06/19/23, 09:12

    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

  8. Simon Praetorius commented and changed status Needs Feedback Resolved 06/19/23, 09:47

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

  9. Benni Mack changed status Resolved Closed 07/09/24, 12:46