From 34892ad08466055b16e4d5938ea9f9087af4e70f Mon Sep 17 00:00:00 2001 From: Nico de Haen Date: Tue, 23 Sep 2025 08:13:07 +0200 Subject: [PATCH] Keep order of typoscript keys --- Classes/Utility/TemplateUtility.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Classes/Utility/TemplateUtility.php b/Classes/Utility/TemplateUtility.php index 2593bc186..dae934d2d 100644 --- a/Classes/Utility/TemplateUtility.php +++ b/Classes/Utility/TemplateUtility.php @@ -48,8 +48,13 @@ public static function getTemplateFolders(string $part = 'template', $returnAllP $configuration = self::getConfigurationManager() ->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'femanager'); if (!empty($configuration['view'][$part . 'RootPaths'] ?? '')) { - $templatePaths = $configuration['view'][$part . 'RootPaths'] ?? ''; - $templatePaths = array_values($templatePaths); + // typoscript keys should be sorted here, but aren't!! + $unsortedTemplatePaths = $configuration['view'][$part . 'RootPaths'] ?? ''; + $arrayKeys = array_keys($unsortedTemplatePaths); + sort($arrayKeys); + foreach ($arrayKeys as $key) { + $templatePaths[] = $unsortedTemplatePaths[$key]; + } } if ($returnAllPaths || $templatePaths === []) { @@ -60,7 +65,8 @@ public static function getTemplateFolders(string $part = 'template', $returnAllP $templatePaths[] = 'EXT:femanager/Resources/Private/' . ucfirst($part) . 's/'; } - + // this breaks the configured order of paths by removing higher + // priority paths if they have lower priority duplicates $templatePaths = array_unique($templatePaths); $absolutePaths = []; foreach ($templatePaths as $templatePath) {