Issue Bug Closed

#108403Template overrides via page tsconfig not working under certain circumstances

Axel Böswetter 12/05/25, 09:10 updated 11/09/26, 19:31

Description

In one of our current projects, we need/ want to override the email templates for the StageChangeNotification, which is basically possible – as mentioned in the docs – via User/Page TSconfig ( tx_workspaces.emails.* ).

By default the workspaces extension has set

tx_workspaces.emails.layoutRootPaths.90 = EXT:workspaces/Resources/Private/Layouts/
tx_workspaces.emails.partialRootPaths.90 = EXT:workspaces/Resources/Private/Partials/
tx_workspaces.emails.templateRootPaths.90 = EXT:workspaces/Resources/Private/Templates/Email/

So normally one would set an override using a timestamp as identifier to get e.g. the following result:

tx_workspaces.emails.layoutRootPaths.90 = EXT:workspaces/Resources/Private/Layouts/
tx_workspaces.emails.partialRootPaths.90 = EXT:workspaces/Resources/Private/Partials/
tx_workspaces.emails.templateRootPaths.90 = EXT:workspaces/Resources/Private/Templates/Email/
tx_workspaces.emails.templateRootPaths.1685524991 = EXT:site_package/Resources/Private/Templates/Email/

If only this override is set, everything works as expected!

BUT, if you have $GLOBALS['TYPO3_CONF_VARS']['MAIL'][...] set as well, things get weird. So, for example you have set the following in your project, e.g. via Backend Install Tool -> Installation wide options -> EXT:core/Resources/Private/Templates/Email/,EXT:backend/Resources/Private/Templates/Email/,EXT:backend/Resources/Private/Templates/Email/,EXT:site_package/Resources/Private/Templates/Email/

That results in the following structure in your settings.php:

...
    'MAIL' => [
        'templateRootPaths' => [
            'EXT:core/Resources/Private/Templates/Email/',
            'EXT:backend/Resources/Private/Templates/Email/',
            'EXT:site_package/Resources/Private/Templates/Email/',
        ],
    ],
...

In the StageChangeNotification->sendEmail() these global settings should be “combined” with the Page TSconfig settings, so e.g.:

'templateRootPaths' => [
    0 => 'EXT:core/Resources/Private/Templates/Email/',
    1 => 'EXT:backend/Resources/Private/Templates/Email/',
    2 => 'EXT:site_package/Resources/Private/Templates/Email/',
],

plus

'templateRootPaths' => [
    90 => 'EXT:workspaces/Resources/Private/Templates/Email/'
    1685524991 = 'EXT:site_package/Resources/Private/Templates/Email/'
],

BUT actually those two arrays don’t get “combined”, they get “replaced” by each other. That results into the following:

'templateRootPaths' => [
    0 => 'EXT:core/Resources/Private/Templates/Email/',
    1 => 'EXT:backend/Resources/Private/Templates/Email/',
    2 => 'EXT:site_package/Resources/Private/Templates/Email/',
    90 => 'EXT:workspaces/Resources/Private/Templates/Email/',
],

So, because of the “replace”, the latter override from the Page TSconfig will be omitted, because the same value is already in the global MAIL settings array (the “source”). And because of that you are not able to override the workspace mail templates in this case.

Right now the only way to fix this, is not to override the workspace templates via Page TSconfig and to manually set array keys in the global MAIL settings array in the settings.php

So setting $GLOBALS['TYPO3_CONF_VARS']['MAIL']['templateRootPaths'] manually to:

...
    'MAIL' => [
        'templateRootPaths' => [
            0 => 'EXT:core/Resources/Private/Templates/Email/',
            1 => 'EXT:backend/Resources/Private/Templates/Email/',
            1764858588 => 'EXT:site_package/Resources/Private/Templates/Email/',
        ],
    ],
...

gets “combined” to the following in StageChangeNotification->sendEmail():

'templateRootPaths' => [
    0 => 'EXT:core/Resources/Private/Templates/Email/',
    1 => 'EXT:backend/Resources/Private/Templates/Email/',
    2 => 'EXT:site_package/Resources/Private/Templates/Email/',
    90 => 'EXT:workspaces/Resources/Private/Templates/Email/',
    1764858588 => 'EXT:site_package/Resources/Private/Templates/Email/',
],

—-

So please don’t use array_replace in StageChangeNotification->sendEmail()@

Reviews 0

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

History 4

  1. Garvin Hicking commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2025-12-05T19:07:01+00:00" > 12/05/25, 19:07 </span>

    Thanks for the good description, and it sounds like you know how to solve it.
    Would you like to create a patch? I can try to help you with questions you may have about contributing.

  2. Maike Kiebele commented <span data-processor="relativetime" data-value="2026-07-31T06:06:34+00:00" > 07/31/26, 06:06 </span>

    Hello,

    I was able to reproduce the issue and took a closer look at it. Based on my investigation, the issue seems to be related to the `array_unique` implementation in `typo3fluid` rather than the `replace()` function itself.

    A patch addressing this issue was introduced in version 14. However, the change was intentionally not backported to version 13. For reference, see:
    https://github.com/TYPO3/Fluid/commit/5f1366e5c1fa8356c81e775b3f68eda3024d7566