Project

General

Profile

Actions

Bug #93544

open

Template overriding for FluidMail ignoring index of path

Added by Tobias Kummer almost 4 years ago. Updated 9 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Mailer API
Start date:
2021-02-18
Due date:
% Done:

0%

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

Description

We have to extensions: cart (cart extension with default email templates) and lst_lwo which overrides some of the cart email templates

Cart ext_localconf.php:

$GLOBALS['TYPO3_CONF_VARS']['MAIL']['templateRootPaths']['1588829280'] = 'EXT:cart/Resources/Private/Templates/';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['partialRootPaths']['1588829280'] = 'EXT:cart/Resources/Private/Partials/';

lst_lwo ext_localconf.php:

$GLOBALS['TYPO3_CONF_VARS']['MAIL']['templateRootPaths'][1613456229] = 'EXT:lst_lwo/Resources/Private/Extensions/Cart/Templates/';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['partialRootPaths'][1613456229] = 'EXT:lst_lwo/Resources/Private/Extensions/Cart/Partials/';

Results in the image "Backend $GLOBALS[‘TYPO3_CONF_VARS’]".

If I debug in FE (instance of FluidEmail), then I find the following (see other image "Frontend debug of FluidEmail instance").

Although the index of "lst_lwo" overriding is higher then the one of "cart", cart templates comes on last position.

Workaround: If I add a dependency to "cart" in "lst_lwo", all works like expected.


Files

Bildschirmfoto 2021-02-16 um 08.02.35.png (43.8 KB) Bildschirmfoto 2021-02-16 um 08.02.35.png Frontend debug of FluidEmail instance Tobias Kummer, 2021-02-18 10:17
Bildschirmfoto 2021-02-16 um 08.01.55.png (41.2 KB) Bildschirmfoto 2021-02-16 um 08.01.55.png Backend $GLOBALS[‘TYPO3_CONF_VARS’] Tobias Kummer, 2021-02-18 10:17
Actions #1

Updated by Ramon Zöllner almost 3 years ago

I ran into this issue as well and this is what I found:

Short Version
the sorting of paths is skipped when using the constructor of

TYPO3Fluid\Fluid\View\TemplatePaths

with an array.

Longer Version

In FluidEmail::initializeView we have

$templatePaths = $templatePaths ?? new TemplatePaths($GLOBALS['TYPO3_CONF_VARS']['MAIL']);

The constructor of TYPO3Fluid\Fluid\View\TemplatePaths calls

TemplatePaths::fillFromConfigurationArray

which extracts the different path parts via
TemplatePaths::extractPathArrays

but during this process the numerical indices are lost and the paths can not be sorted later.

Normally the TYPO3 implementation of TYPO3\CMS\Fluid\View\TemplatePaths takes care of path sorting, but only for paths that are configured in TypoScript (as far as I can tell).

As the error is not limited to Mailer, but all instances where template overriding is done in PHP and not TypoScript, I think this is more of a Fluid issue than Mailer API.

Actions #2

Updated by Hartmut Steglich over 2 years ago

  • TYPO3 Version changed from 10 to 11

Same issue still with TYPO3 11.5.10

Are there any workarounds (like using TS)?

Actions #3

Updated by Stephan Bauer 9 months ago

Same in 12.4.10

Actions

Also available in: Atom PDF