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) {