diff --git a/typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php b/typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php index 811cc02aa36f594cfe6dca7d7e6cf59ae3eace71..371fc9bafbe086e93d53e0d4e1b78857f6890522 100644 --- a/typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php +++ b/typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php @@ -162,31 +162,20 @@ class EmailFinisher extends AbstractFinisher protected function initializeTemplatePaths(array $globalConfig, array $localConfig): TemplatePaths { - if (is_array($localConfig['templateRootPaths'] ?? null)) { - $globalConfig['templateRootPaths'] = array_replace_recursive( - $globalConfig['templateRootPaths'], - $localConfig['templateRootPaths'] - ); - ksort($globalConfig['templateRootPaths']); - } - - if (is_array($localConfig['partialRootPaths'] ?? null)) { - $globalConfig['partialRootPaths'] = array_replace_recursive( - $globalConfig['partialRootPaths'], - $localConfig['partialRootPaths'] - ); - ksort($globalConfig['partialRootPaths']); - } - - if (is_array($localConfig['layoutRootPaths'] ?? null)) { - $globalConfig['layoutRootPaths'] = array_replace_recursive( - $globalConfig['layoutRootPaths'], - $localConfig['layoutRootPaths'] - ); - ksort($globalConfig['layoutRootPaths']); - } - - return GeneralUtility::makeInstance(TemplatePaths::class, $globalConfig); + $templatePaths = new TemplatePaths(); + $templatePaths->setTemplateRootPaths(array_replace( + $globalConfig['templateRootPaths'] ?? [], + $localConfig['templateRootPaths'] ?? [], + )); + $templatePaths->setLayoutRootPaths(array_replace( + $globalConfig['layoutRootPaths'] ?? [], + $localConfig['layoutRootPaths'] ?? [], + )); + $templatePaths->setPartialRootPaths(array_replace( + $globalConfig['partialRootPaths'] ?? [], + $localConfig['partialRootPaths'] ?? [], + )); + return $templatePaths; } protected function initializeFluidEmail(FormRuntime $formRuntime): FluidEmail diff --git a/typo3/sysext/form/Tests/Unit/Domain/Finishers/EmailFinisherTest.php b/typo3/sysext/form/Tests/Unit/Domain/Finishers/EmailFinisherTest.php index d6256382c6ed8166707a35d3f2ee4550801ecf31..f8d1c77c5929ef89d3d38cba7d88f71853bf07a6 100644 --- a/typo3/sysext/form/Tests/Unit/Domain/Finishers/EmailFinisherTest.php +++ b/typo3/sysext/form/Tests/Unit/Domain/Finishers/EmailFinisherTest.php @@ -52,16 +52,16 @@ final class EmailFinisherTest extends UnitTestCase ], 'expected' => [ 'templateRootPaths' => [ - 'EXT:core/Resources/Private/Templates/Email/', - 'EXT:form/Resources/Private/Frontend/Templates/Finishers/Email/', + 0 => 'EXT:core/Resources/Private/Templates/Email/', + 10 => 'EXT:form/Resources/Private/Frontend/Templates/Finishers/Email/', ], 'layoutRootPaths' => [ - 'EXT:core/Resources/Private/Layouts/', - 'EXT:backend/Resources/Private/Layouts/', + 0 => 'EXT:core/Resources/Private/Layouts/', + 10 => 'EXT:backend/Resources/Private/Layouts/', ], 'partialRootPaths' => [ - 'EXT:core/Resources/Private/Partials/', - 'EXT:backend/Resources/Private/Partials/', + 0 => 'EXT:core/Resources/Private/Partials/', + 10 => 'EXT:backend/Resources/Private/Partials/', ], ], ], @@ -91,17 +91,17 @@ final class EmailFinisherTest extends UnitTestCase ], 'expected' => [ 'templateRootPaths' => [ - 'EXT:core/Resources/Private/Templates/Email/', - 'EXT:form/Resources/Private/Frontend/Templates/Finishers/Email/', - 'EXT:myextension/Resources/Private/Templates/Form/Email/', + 0 => 'EXT:core/Resources/Private/Templates/Email/', + 10 => 'EXT:form/Resources/Private/Frontend/Templates/Finishers/Email/', + 20 => 'EXT:myextension/Resources/Private/Templates/Form/Email/', ], 'layoutRootPaths' => [ - 'EXT:core/Resources/Private/Layouts/', - 'EXT:backend/Resources/Private/Layouts/', + 0 => 'EXT:core/Resources/Private/Layouts/', + 10 => 'EXT:backend/Resources/Private/Layouts/', ], 'partialRootPaths' => [ - 'EXT:core/Resources/Private/Partials/', - 'EXT:backend/Resources/Private/Partials/', + 0 => 'EXT:core/Resources/Private/Partials/', + 10 => 'EXT:backend/Resources/Private/Partials/', ], ], ], @@ -138,22 +138,22 @@ final class EmailFinisherTest extends UnitTestCase ], 'expected' => [ 'templateRootPaths' => [ - 'EXT:core/Resources/Private/Templates/Email/', - 'EXT:form/Resources/Private/Frontend/Templates/Finishers/Email/', - 'path/to/myextension/Resources/Private/Templates/Email/', - 'path/to/myextension/Resources/Private/Templates/Form/Email/', + 0 => 'EXT:core/Resources/Private/Templates/Email/', + 10 => 'EXT:form/Resources/Private/Frontend/Templates/Finishers/Email/', + 20 => 'path/to/myextension/Resources/Private/Templates/Email/', + 100 => 'path/to/myextension/Resources/Private/Templates/Form/Email/', ], 'layoutRootPaths' => [ - 'EXT:core/Resources/Private/Layouts/', - 'EXT:backend/Resources/Private/Layouts/', - 'path/to/myextension/Resources/Private/Layouts/Email/', - 'path/to/myextension/Resources/Private/Layouts/Form/Email/', + 0 => 'EXT:core/Resources/Private/Layouts/', + 10 => 'EXT:backend/Resources/Private/Layouts/', + 20 => 'path/to/myextension/Resources/Private/Layouts/Email/', + 100 => 'path/to/myextension/Resources/Private/Layouts/Form/Email/', ], 'partialRootPaths' => [ - 'EXT:core/Resources/Private/Partials/', - 'EXT:backend/Resources/Private/Partials/', - 'path/to/myextension/Resources/Private/Partials/Email/', - 'path/to/myextension/Resources/Private/Partials/Form/Email/', + 0 => 'EXT:core/Resources/Private/Partials/', + 10 => 'EXT:backend/Resources/Private/Partials/', + 20 => 'path/to/myextension/Resources/Private/Partials/Email/', + 100 => 'path/to/myextension/Resources/Private/Partials/Form/Email/', ], ], ], diff --git a/typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php b/typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php index 1d28ee28d92c9659ea6d184ce1d725edf9b35a10..8c2ab76e8998de2259101ac6ddd5f6af1b17da86 100644 --- a/typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php +++ b/typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php @@ -506,14 +506,13 @@ class ValidatorTask extends AbstractTask */ protected function getFluidEmail(): FluidEmail { - $templateConfiguration = array_replace_recursive( - $GLOBALS['TYPO3_CONF_VARS']['MAIL'], - ['templateRootPaths' => [20 => 'EXT:linkvalidator/Resources/Private/Templates/Email/']] - ); - - // must be sorted after adding the default path to ensure already registered custom paths are called first - ksort($templateConfiguration['templateRootPaths']); - $templatePaths = GeneralUtility::makeInstance(TemplatePaths::class, $templateConfiguration); + $templatePaths = new TemplatePaths(); + $templatePaths->setTemplateRootPaths(array_replace( + $GLOBALS['TYPO3_CONF_VARS']['MAIL']['templateRootPaths'] ?? [], + [20 => 'EXT:linkvalidator/Resources/Private/Templates/Email/'], + )); + $templatePaths->setLayoutRootPaths($GLOBALS['TYPO3_CONF_VARS']['MAIL']['layoutRootPaths'] ?? []); + $templatePaths->setPartialRootPaths($GLOBALS['TYPO3_CONF_VARS']['MAIL']['partialRootPaths'] ?? []); if ($this->emailTemplateName === '' || !$this->templateFilesExist($templatePaths->getTemplateRootPaths())) { // Add default template name to task if empty or given template name does not exist