diff --git a/typo3/sysext/core/Classes/Mail/FluidEmail.php b/typo3/sysext/core/Classes/Mail/FluidEmail.php index 391fca08f7a22b356491ba3abed2b6c4f8241e07..a66b3a5d51af56c8ce92ecdbf187269681ee394a 100644 --- a/typo3/sysext/core/Classes/Mail/FluidEmail.php +++ b/typo3/sysext/core/Classes/Mail/FluidEmail.php @@ -77,7 +77,13 @@ class FluidEmail extends Email // we *could* unpack the paths and format to an array again, we should probably better // redesign this implementation and work on the main comment above along the way. // Also note methods like getViewHelperVariableContainer() are hard-bound to fluid, too. - $templatePaths = $templatePaths ?? new TemplatePaths($GLOBALS['TYPO3_CONF_VARS']['MAIL']); + if ($templatePaths === null) { + $templatePaths = new TemplatePaths(); + $templatePaths->setTemplateRootPaths($GLOBALS['TYPO3_CONF_VARS']['MAIL']['templateRootPaths'] ?? []); + $templatePaths->setLayoutRootPaths($GLOBALS['TYPO3_CONF_VARS']['MAIL']['layoutRootPaths'] ?? []); + $templatePaths->setPartialRootPaths($GLOBALS['TYPO3_CONF_VARS']['MAIL']['partialRootPaths'] ?? []); + } + $this->view->getRenderingContext()->setTemplatePaths($templatePaths); $this->view->assignMultiple($this->getDefaultVariables()); $this->format($GLOBALS['TYPO3_CONF_VARS']['MAIL']['format'] ?? self::FORMAT_BOTH); diff --git a/typo3/sysext/felogin/Classes/Configuration/RecoveryConfiguration.php b/typo3/sysext/felogin/Classes/Configuration/RecoveryConfiguration.php index 8e3ea9e3c96c16181ae6b7361921c21e7ac0b8ba..6e35ad31db5589a6d2948f64e6fb1608561de80b 100644 --- a/typo3/sysext/felogin/Classes/Configuration/RecoveryConfiguration.php +++ b/typo3/sysext/felogin/Classes/Configuration/RecoveryConfiguration.php @@ -65,20 +65,20 @@ class RecoveryConfiguration implements LoggerAwareInterface */ public function getMailTemplatePaths(): TemplatePaths { - $pathArray = array_replace_recursive( - [ - 'layoutRootPaths' => $GLOBALS['TYPO3_CONF_VARS']['MAIL']['layoutRootPaths'], - 'templateRootPaths' => $GLOBALS['TYPO3_CONF_VARS']['MAIL']['templateRootPaths'], - 'partialRootPaths' => $GLOBALS['TYPO3_CONF_VARS']['MAIL']['partialRootPaths'], - ], - [ - 'layoutRootPaths' => $this->settings['email']['layoutRootPaths'], - 'templateRootPaths' => $this->settings['email']['templateRootPaths'], - 'partialRootPaths' => $this->settings['email']['partialRootPaths'], - ] - ); - - return new TemplatePaths($pathArray); + $templatePaths = new TemplatePaths(); + $templatePaths->setTemplateRootPaths(array_replace( + $GLOBALS['TYPO3_CONF_VARS']['MAIL']['templateRootPaths'] ?? [], + $this->settings['email']['templateRootPaths'] ?? [], + )); + $templatePaths->setLayoutRootPaths(array_replace( + $GLOBALS['TYPO3_CONF_VARS']['MAIL']['layoutRootPaths'] ?? [], + $this->settings['email']['layoutRootPaths'] ?? [], + )); + $templatePaths->setPartialRootPaths(array_replace( + $GLOBALS['TYPO3_CONF_VARS']['MAIL']['partialRootPaths'] ?? [], + $this->settings['email']['partialRootPaths'] ?? [], + )); + return $templatePaths; } /** diff --git a/typo3/sysext/felogin/Tests/Unit/Configuration/RecoveryConfigurationTest.php b/typo3/sysext/felogin/Tests/Unit/Configuration/RecoveryConfigurationTest.php index d4dc934db760e2424b032f98e64c6669565b779c..1feff5f57c11782c4716d41dd6f1f642d24487e1 100644 --- a/typo3/sysext/felogin/Tests/Unit/Configuration/RecoveryConfigurationTest.php +++ b/typo3/sysext/felogin/Tests/Unit/Configuration/RecoveryConfigurationTest.php @@ -175,9 +175,9 @@ final class RecoveryConfigurationTest extends UnitTestCase $actualTemplatePaths = $this->subject->getMailTemplatePaths(); self::assertSame( [ - Environment::getPublicPath() . '/typo3/sysext/core/Resources/Private/Templates/', - Environment::getPublicPath() . '/typo3/sysext/backend/Resources/Private/Templates/', - '/some/path/to/a/template/folder/', + 0 => Environment::getPublicPath() . '/typo3/sysext/core/Resources/Private/Templates/', + 10 => Environment::getPublicPath() . '/typo3/sysext/backend/Resources/Private/Templates/', + 20 => '/some/path/to/a/template/folder/', ], $actualTemplatePaths->getTemplateRootPaths() ); @@ -195,8 +195,8 @@ final class RecoveryConfigurationTest extends UnitTestCase $actualTemplatePaths = $this->subject->getMailTemplatePaths(); self::assertSame( [ - Environment::getPublicPath() . '/typo3/sysext/core/Resources/Private/Templates/', - '/some/path/to/a/template/folder/', + 0 => Environment::getPublicPath() . '/typo3/sysext/core/Resources/Private/Templates/', + 10 => '/some/path/to/a/template/folder/', ], $actualTemplatePaths->getTemplateRootPaths() ); diff --git a/typo3/sysext/fluid/Tests/Unit/View/TemplatePathsTest.php b/typo3/sysext/fluid/Tests/Unit/View/TemplatePathsTest.php index d5ba5530433ca799f0a146c962ff8dc0fa94315e..8e3c79a34cf485ed9f052621369a3864d8040328 100644 --- a/typo3/sysext/fluid/Tests/Unit/View/TemplatePathsTest.php +++ b/typo3/sysext/fluid/Tests/Unit/View/TemplatePathsTest.php @@ -77,15 +77,15 @@ final class TemplatePathsTest extends UnitTestCase return [$method, $set, $expected]; }; return [ - 'simple numeric index, template' => $generator(TemplatePaths::CONFIG_TEMPLATEROOTPATHS, 'numeric'), - 'alpha index, template' => $generator(TemplatePaths::CONFIG_TEMPLATEROOTPATHS, 'alpha'), - 'alpha-numeric index, template' => $generator(TemplatePaths::CONFIG_TEMPLATEROOTPATHS, 'alphanumeric'), - 'simple numeric index, partial' => $generator(TemplatePaths::CONFIG_PARTIALROOTPATHS, 'numeric'), - 'alpha index, partial' => $generator(TemplatePaths::CONFIG_PARTIALROOTPATHS, 'alpha'), - 'alpha-numeric index, partial' => $generator(TemplatePaths::CONFIG_PARTIALROOTPATHS, 'alphanumeric'), - 'simple numeric index, layout' => $generator(TemplatePaths::CONFIG_LAYOUTROOTPATHS, 'numeric'), - 'alpha index, layout' => $generator(TemplatePaths::CONFIG_LAYOUTROOTPATHS, 'alpha'), - 'alpha-numeric index, layout' => $generator(TemplatePaths::CONFIG_LAYOUTROOTPATHS, 'alphanumeric'), + 'simple numeric index, template' => $generator('templateRootPaths', 'numeric'), + 'alpha index, template' => $generator('templateRootPaths', 'alpha'), + 'alpha-numeric index, template' => $generator('templateRootPaths', 'alphanumeric'), + 'simple numeric index, partial' => $generator('partialRootPaths', 'numeric'), + 'alpha index, partial' => $generator('partialRootPaths', 'alpha'), + 'alpha-numeric index, partial' => $generator('partialRootPaths', 'alphanumeric'), + 'simple numeric index, layout' => $generator('layoutRootPaths', 'numeric'), + 'alpha index, layout' => $generator('layoutRootPaths', 'alpha'), + 'alpha-numeric index, layout' => $generator('layoutRootPaths', 'alphanumeric'), ]; } diff --git a/typo3/sysext/install/Classes/Authentication/AuthenticationService.php b/typo3/sysext/install/Classes/Authentication/AuthenticationService.php index 7ccab7498e464d2bae723087a576d4c8a80aa1f7..56522d4260f8a464d9fd09898c7be868ec2cb4ef 100644 --- a/typo3/sysext/install/Classes/Authentication/AuthenticationService.php +++ b/typo3/sysext/install/Classes/Authentication/AuthenticationService.php @@ -41,9 +41,13 @@ class AuthenticationService public function __construct(protected readonly MailerInterface $mailer) { - $templateConfiguration = $GLOBALS['TYPO3_CONF_VARS']['MAIL']; - $templateConfiguration['templateRootPaths'][20] = 'EXT:install/Resources/Private/Templates/Email/'; - $this->templatePaths = new TemplatePaths($templateConfiguration); + $this->templatePaths = new TemplatePaths(); + $this->templatePaths->setTemplateRootPaths(array_replace( + $GLOBALS['TYPO3_CONF_VARS']['MAIL']['templateRootPaths'] ?? [], + [20 => 'EXT:install/Resources/Private/Templates/Email/'], + )); + $this->templatePaths->setLayoutRootPaths($GLOBALS['TYPO3_CONF_VARS']['MAIL']['layoutRootPaths'] ?? []); + $this->templatePaths->setPartialRootPaths($GLOBALS['TYPO3_CONF_VARS']['MAIL']['partialRootPaths'] ?? []); } /** diff --git a/typo3/sysext/reports/Classes/Task/SystemStatusUpdateTask.php b/typo3/sysext/reports/Classes/Task/SystemStatusUpdateTask.php index b4ffda55a09656976b979f2aa838536a7f132e9f..46e0d12da39a6822cc4f1a32fc524e0f5f904352 100644 --- a/typo3/sysext/reports/Classes/Task/SystemStatusUpdateTask.php +++ b/typo3/sysext/reports/Classes/Task/SystemStatusUpdateTask.php @@ -116,10 +116,15 @@ class SystemStatusUpdateTask extends AbstractTask $message .= implode(CRLF, $systemIssues); $message .= CRLF . CRLF; - $templateConfiguration = $GLOBALS['TYPO3_CONF_VARS']['MAIL']; - $templateConfiguration['templateRootPaths'][20] = 'EXT:reports/Resources/Private/Templates/Email/'; + $templatePaths = new TemplatePaths(); + $templatePaths->setTemplateRootPaths(array_replace( + $GLOBALS['TYPO3_CONF_VARS']['MAIL']['templateRootPaths'] ?? [], + [20 => 'EXT:reports/Resources/Private/Templates/Email/'], + )); + $templatePaths->setLayoutRootPaths($GLOBALS['TYPO3_CONF_VARS']['MAIL']['layoutRootPaths'] ?? []); + $templatePaths->setPartialRootPaths($GLOBALS['TYPO3_CONF_VARS']['MAIL']['partialRootPaths'] ?? []); - $email = GeneralUtility::makeInstance(FluidEmail::class, new TemplatePaths($templateConfiguration)); + $email = GeneralUtility::makeInstance(FluidEmail::class, $templatePaths); $email ->to(...$sendEmailsTo) ->format('plain') diff --git a/typo3/sysext/workspaces/Classes/Notification/StageChangeNotification.php b/typo3/sysext/workspaces/Classes/Notification/StageChangeNotification.php index c7bdee47bd8e6acf818e13d9bc40ff15ee558e10..c27ab8d1ea0029d5ca6bad71004e7078753a00b2 100644 --- a/typo3/sysext/workspaces/Classes/Notification/StageChangeNotification.php +++ b/typo3/sysext/workspaces/Classes/Notification/StageChangeNotification.php @@ -141,7 +141,20 @@ class StageChangeNotification implements LoggerAwareInterface */ protected function sendEmail(array $recipientData, array $emailConfig, array $variablesForView): void { - $templatePaths = new TemplatePaths(array_replace_recursive($GLOBALS['TYPO3_CONF_VARS']['MAIL'], $emailConfig)); + $templatePaths = new TemplatePaths(); + $templatePaths->setTemplateRootPaths(array_replace( + $GLOBALS['TYPO3_CONF_VARS']['MAIL']['templateRootPaths'] ?? [], + $emailConfig['templateRootPaths'] ?? [], + )); + $templatePaths->setLayoutRootPaths(array_replace( + $GLOBALS['TYPO3_CONF_VARS']['MAIL']['layoutRootPaths'] ?? [], + $emailConfig['layoutRootPaths'] ?? [], + )); + $templatePaths->setPartialRootPaths(array_replace( + $GLOBALS['TYPO3_CONF_VARS']['MAIL']['partialRootPaths'] ?? [], + $emailConfig['partialRootPaths'] ?? [], + )); + $emailObject = GeneralUtility::makeInstance(FluidEmail::class, $templatePaths); $emailObject ->to(new Address($recipientData['email'], $recipientData['realName'] ?? ''))