From 8b2c3dabd015f6bb50beca6a6127b525dfd2b416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=A4u=C3=9Fler?= Date: Tue, 7 Jan 2025 18:56:28 +0100 Subject: [PATCH] [!!!][TASK] Streamline view configuration across path providers --- Classes/DependencyInjection/Extension/Configuration.php | 4 ++-- .../DependencyInjection/Extension/HandlebarsExtension.php | 2 +- Configuration/Services.yaml | 2 +- Documentation/Configuration/TemplatePaths/Index.rst | 2 +- .../Extension/HandlebarsExtensionTest.php | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Classes/DependencyInjection/Extension/Configuration.php b/Classes/DependencyInjection/Extension/Configuration.php index 9ce7b827..42403152 100644 --- a/Classes/DependencyInjection/Extension/Configuration.php +++ b/Classes/DependencyInjection/Extension/Configuration.php @@ -34,7 +34,7 @@ * - defaultData: * - [data]: any default data passed to the renderer * - * - template: + * - view: * - [templateRootPaths]: numeric array of template root paths * - [partialRootPaths]: numeric array of partial root paths * @@ -57,7 +57,7 @@ public function getConfigTreeBuilder(): TreeBuilder ->performNoDeepMerging() ->variablePrototype()->end() ->end() - ->arrayNode('template') + ->arrayNode('view') ->children() ->arrayNode('templateRootPaths') ->beforeNormalization() diff --git a/Classes/DependencyInjection/Extension/HandlebarsExtension.php b/Classes/DependencyInjection/Extension/HandlebarsExtension.php index 3b0ba9c0..29044881 100644 --- a/Classes/DependencyInjection/Extension/HandlebarsExtension.php +++ b/Classes/DependencyInjection/Extension/HandlebarsExtension.php @@ -75,8 +75,8 @@ public function load(array $configs, ContainerBuilder $container): void */ private function parseConfiguration(array $configs): void { - $templateConfig = $this->mergeConfigs($configs, 'template'); $this->defaultData = $this->mergeConfigs($configs, 'default_data'); + $templateConfig = $this->mergeConfigs($configs, 'view'); $this->templateRootPaths = $templateConfig['templateRootPaths'] ?? []; $this->partialRootPaths = $templateConfig['partialRootPaths'] ?? []; } diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index cebfbbe8..a7fb1629 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -28,6 +28,6 @@ services: handlebars: default_data: [] - template: + view: templateRootPaths: [] partialRootPaths: [] diff --git a/Documentation/Configuration/TemplatePaths/Index.rst b/Documentation/Configuration/TemplatePaths/Index.rst index a6ab8c77..339a31f2 100644 --- a/Documentation/Configuration/TemplatePaths/Index.rst +++ b/Documentation/Configuration/TemplatePaths/Index.rst @@ -27,7 +27,7 @@ is by using the :file:`Services.yaml` file: # Configuration/Services.yaml handlebars: - template: + view: templateRootPaths: 10: EXT:my_extension/Resources/Private/Templates partialRootPaths: diff --git a/Tests/Unit/DependencyInjection/Extension/HandlebarsExtensionTest.php b/Tests/Unit/DependencyInjection/Extension/HandlebarsExtensionTest.php index b8c7cd80..e42894f7 100644 --- a/Tests/Unit/DependencyInjection/Extension/HandlebarsExtensionTest.php +++ b/Tests/Unit/DependencyInjection/Extension/HandlebarsExtensionTest.php @@ -117,12 +117,12 @@ public static function loadAddsResolvedParametersToContainerDataProvider(): \Gen yield 'template root paths' => [ [ [ - 'template' => [ + 'view' => [ 'templateRootPaths' => $firstRootPaths, ], ], [ - 'template' => [ + 'view' => [ 'templateRootPaths' => $secondRootPaths, ], ], @@ -136,12 +136,12 @@ public static function loadAddsResolvedParametersToContainerDataProvider(): \Gen yield 'partial root paths' => [ [ [ - 'template' => [ + 'view' => [ 'partialRootPaths' => $firstRootPaths, ], ], [ - 'template' => [ + 'view' => [ 'partialRootPaths' => $secondRootPaths, ], ],