Skip to content

Commit

Permalink
Merge pull request #385 from CPS-IT/task/1.x/view-parameter
Browse files Browse the repository at this point in the history
[!!!][TASK] Streamline view configuration across path providers
  • Loading branch information
eliashaeussler authored Jan 7, 2025
2 parents fcf946e + 8b2c3da commit e25b6fd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Classes/DependencyInjection/Extension/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -57,7 +57,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->performNoDeepMerging()
->variablePrototype()->end()
->end()
->arrayNode('template')
->arrayNode('view')
->children()
->arrayNode('templateRootPaths')
->beforeNormalization()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ?? [];
}
Expand Down
2 changes: 1 addition & 1 deletion Configuration/Services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ services:

handlebars:
default_data: []
template:
view:
templateRootPaths: []
partialRootPaths: []
2 changes: 1 addition & 1 deletion Documentation/Configuration/TemplatePaths/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ public static function loadAddsResolvedParametersToContainerDataProvider(): \Gen
yield 'template root paths' => [
[
[
'template' => [
'view' => [
'templateRootPaths' => $firstRootPaths,
],
],
[
'template' => [
'view' => [
'templateRootPaths' => $secondRootPaths,
],
],
Expand All @@ -136,12 +136,12 @@ public static function loadAddsResolvedParametersToContainerDataProvider(): \Gen
yield 'partial root paths' => [
[
[
'template' => [
'view' => [
'partialRootPaths' => $firstRootPaths,
],
],
[
'template' => [
'view' => [
'partialRootPaths' => $secondRootPaths,
],
],
Expand Down

0 comments on commit e25b6fd

Please sign in to comment.